-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathsuccess-payment.php
executable file
·36 lines (26 loc) · 1.16 KB
/
success-payment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
session_start();
require('BkashHelper.php');
$bkash_helper = new BkashHelper();
$final_amount = $_SESSION['final_amount'];
$api_response = json_decode($_GET['response'], true); // Getting Response from bKash API.
$transaction_trxId = $api_response['trxID']; // bKash trxId.
// IF CONDITION Transaction Duplicate THEN YOU CAN DIE Here
if ('Noman' == 'failed') {
echo "This Transaction ID is Already Used and Please Use Correct Transaction ID.";
die();
}
// Assign Transaction Information
$transaction_amount = $api_response['amount']; // bKash Payment Amount.
$transaction_reference = $api_response['merchantInvoiceNumber']; // bKash Reference for Invoice ID.
$transaction_sender = null;
$count = 0; // transaction search count
while (!$transaction_sender) {
$search_trxId_res = $bkash_helper->searchTransaction($transaction_trxId); // search transaction to get sender
$search_trxId_res = json_decode($search_trxId_res, true);
$transaction_sender = ltrim($search_trxId_res['customerMsisdn'], '88'); // bKash Sender.
if ($count === 100) {
$transaction_sender = 'not found';
}
}
// DB :: INSERT Transaction information