request('POST', $base_url.'/v1.2.0-beta/tokenized/checkout/token/grant', [ 'body' => json_encode([ 'app_key' => $app_key, 'app_secret' => $app_secret ]), 'headers' => [ 'accept' => 'application/json', 'content-type' => 'application/json', 'password' => $password, 'username' => $username, ], ]); $response = json_decode($response->getBody()); $id_token = $response->id_token; ?> <?php echo $settings['display_name']?> - <?php echo $setting['response'][0]['site_name']?> ">
" alt="Merchant Logo" class="merchant-logo">
$paymentID ); $url = curl_init($base_url.'/v1.2.0-beta/tokenized/checkout/execute'); $posttoken = json_encode($post_token); $header = array( 'Content-Type:application/json', 'Authorization:' . $auth, 'X-APP-Key:'.$app_key ); curl_setopt($url, CURLOPT_HTTPHEADER, $header); curl_setopt($url, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($url, CURLOPT_RETURNTRANSFER, true); curl_setopt($url, CURLOPT_POSTFIELDS, $posttoken); curl_setopt($url, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($url, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); $resultdata = curl_exec($url); curl_close($url); $obj = json_decode($resultdata); if(isset($obj->transactionStatus)){ $transactionStatus = $obj->transactionStatus; if($transactionStatus == "Completed"){ $customerMsisdn = $obj->customerMsisdn; $paymentID = $obj->paymentID; $trxID = $obj->trxID; $merchantInvoiceNumber = $obj->merchantInvoiceNumber; $time = $obj->paymentExecuteTime; $amount = $obj->amount; $payerAccount = $obj->payerAccount; $parts = explode("_", $merchantInvoiceNumber); $order_id = $parts[1]; if ($settings['bkash_mode'] == "sandbox") { // Make sure $resultdata is valid JSON echo '
'; } else { $check_transactionid = pp_check_transaction_exits($trxID); if($check_transactionid['status'] == false){ if(pp_set_transaction_byid($payment_id, $plugin_slug, $plugin_info['plugin_name'], $payerAccount, $trxID, 'completed')){ echo ''; } }else{ ?> '0011', 'amount' => ceil($transaction_amount), 'currency' => 'BDT', 'intent' => 'sale', 'payerReference' => rand().'_'.$payment_id, 'merchantInvoiceNumber' => rand().'_'.$payment_id, 'callbackURL' => getCurrentUrl() ); $url = curl_init($base_url.'/v1.2.0-beta/tokenized/checkout/create'); $requestbodyJson = json_encode($requestbody); $header = array( 'Content-Type:application/json', 'Authorization:'.$auth, 'X-APP-Key:'.$app_key ); curl_setopt($url, CURLOPT_HTTPHEADER, $header); curl_setopt($url, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($url, CURLOPT_RETURNTRANSFER, true); curl_setopt($url, CURLOPT_POSTFIELDS, $requestbodyJson); curl_setopt($url, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($url, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); $resultdata = curl_exec($url); curl_close($url); $obj = json_decode($resultdata); if ($settings['bkash_mode'] == "sandbox") { // Make sure $resultdata is valid JSON echo '
'; // Decode JSON to use bkashURL $obj = json_decode($resultdata, true); ?> location.href="'.$obj['bkashURL'].'";'; } } ?>