Code Log
unknown
php_laravel_blade
2 years ago
3.3 kB
5
Indexable
$duitkuConfig = new \Duitku\Config("f7bab717a968313ccc8fa212570a1f53", "DS13522"); // false for production mode // true for sandbox mode $duitkuConfig->setSandboxMode(true); // set sanitizer (default : true) $duitkuConfig->setSanitizedMode(false); // set log parameter (default : true) $duitkuConfig->setDuitkuLogs(false); // $gross_amount = 10000; $gross_amount = 150000; $paymentAmount = $gross_amount; // Amount $paymentMethod = "VC"; // Permata Bank Virtual Account $email = "ahmad.fatoni@mindotek.com"; // your customer email $phoneNumber = "089676490971"; // your customer phone number (optional) $productDetails = ""; $merchantOrderId = 20220930173051; // from merchant, unique $additionalParam = ''; // optional $merchantUserInfo = ''; // optional $customerVaName = "Ahmad Fatoni"; // display name on bank confirmation display $callbackUrl = 'https://koperasi-santri.mindotek.com/callback'; // url for callback $returnUrl = 'https://koperasi-santri.mindotek.com/Invoice/detail/20220930173051'; // url for redirect $expiryPeriod = 60; // set the expired time in minutes // Customer Detail $firstName = "Ahmad"; $lastName = "Fatoni"; // Address $alamat = "jl. raya cilegon km.03"; $city = "Banten"; $postalCode = "42162; $countryCode = "ID"; $address = array( 'firstName' => $firstName, 'lastName' => $lastName, 'address' => $alamat, 'city' => $city, 'postalCode' => $postalCode, 'phone' => $phoneNumber, 'countryCode' => $countryCode ); $customerDetail = array( 'firstName' => $firstName, 'lastName' => $lastName, 'email' => $email, 'phoneNumber' => $phoneNumber, 'billingAddress' => $address, 'shippingAddress' => $address ); $params = array( 'paymentAmount' => $paymentAmount, 'paymentMethod' => $paymentMethod, 'merchantOrderId' => $merchantOrderId, 'productDetails' => $productDetails, 'additionalParam' => $additionalParam, 'merchantUserInfo' => $merchantUserInfo, 'customerVaName' => $customerVaName, 'email' => $email, 'phoneNumber' => $phoneNumber, 'customerDetail' => $customerDetail, 'callbackUrl' => $callbackUrl, 'returnUrl' => $returnUrl, 'expiryPeriod' => $expiryPeriod ); try { $responseDuitkuApi = \Duitku\Api::createInvoice($params, $duitkuConfig); $transactionList = \Duitku\Api::transactionStatus($merchantOrderId, $duitkuConfig); $response = json_decode($responseDuitkuApi); $trx = json_decode($transactionList); if ($paymentMethod != 'VC') { $data['tujuan_pembayaran'] = $response->vaNumber; } else { $data['tujuan_pembayaran'] = ''; } // var_dump($responseDuitkuApi); if ($paymentMethod != 'VC') { redirect(base_url('invoice/detail/' . $trx->merchantOrderId)); } else { redirect($response->paymentUrl); } } catch (Exception $e) { echo $e->getMessage(); }
Editor is loading...