This request sent to my specified url from payment gateway over http post request
POST https://mywebsite.com/checkout/?oid=12345
{
"status":"SUCCESS",
"notif_token":"dd497bda3b250e536186fc0663f32f40",
"txnid": "MP150709.1341.A00073"
}
screenshot of payment gateway documentation
how to receive this request data in checkout.php file
i want to store this data into variable
// Get the JSON contents notif respone in varibale
$notif_response_body = file_get_contents('php://input');
// decode json respone
$notif_response_data = json_decode($notif_response_body, true);
switch ($notif_response_data['status']){
case "PENDING":
$sorder->add_order_note( __('The Transaction id ' . $notif_response_data['txnid'] . 'is in progress on Orange Money Payment Gateway ', 'orange_money'), true );
$sorder->status = 'On hold';
break;
case "SUCCESS":
$sorder->add_order_note( __('Order Paid via Orange Money Payment Gateway transaction id : ' . $notif_response_data['txnid'], 'orange_money'), true );
$sorder->status = 'Processing';
break;
case "FAILED":
$sorder->add_order_note( __('Payment Failed on Orange Money Payment Gateway transaction id : ' . $notif_response_data['txnid'], 'orange_money'), true );
$sorder->status = 'Failed';
break;
case "EXPIRED":
$sorder->add_order_note( __('Payment Expired on Orange Money Payment Gateway transaction id : ' . $notif_response_data['txnid'], 'orange_money'), true );
$sorder->status = 'Failed';
break;
default:
break;
}