To know the status of a transaction, you must send the following information in JSON format.
Using this url: https://Sandbox.transfluo.com/checkout
for more details, please see the section Transaction verification
NB: Payment confirmation for some operators is via push notification , your system send a payload request, waiting for payment approval by the user and will be updated according depending on the user response.
When the payment is successful, you will receive this response from TransFluo:
$webhook_payload = [
"status" => 'SUCCES',
"amount" => '500',
"customer" => '67XXXXXXX',
"order_id" => 'SHOP123-20250911-0001',
"reference_id" => 'avf45jhn454frr5vfvf1f4dgfgf1fg1',
"merchant_name" => transfluo_51210320122,
"reason" => 'THE_REASON_IF_THE_TRANSACTION_FAILS',
"timestamp" => date("c"),
];
$payload_json = json_encode($webhook_payload, JSON_UNESCAPED_UNICODE);
$signature = hash_hmac("sha256", $payload_json, $merchant_secret_key);
$ch = curl_init($webhook_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json; charset=UTF-8',
"X-Mya-Signature: $signature"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$webhook_response = curl_exec($ch);
curl_close($ch);
{primary.fa-info} Then you will have to deliver the service. Don't forget to update your database.
In case of failure, you will receive this answer from TransFluo:
$webhook_payload = [
"status" => 'failed',
"amount" => '500',
"customer" => '67XXXXXXX',
"order_id" => 'SHOP123-20250911-0001',
"reference_id" => 'avf45jhn454frr5vfvf1f4dgfgf1fg1',
"merchant_name" => transfluo_51210320122,
"reason" => 'THE_REASON_IF_THE_TRANSACTION_FAILS',
"timestamp" => date("c"),
];
$payload_json = json_encode($webhook_payload, JSON_UNESCAPED_UNICODE);
$signature = hash_hmac("sha256", $payload_json, $merchant_secret_key);
$ch = curl_init($webhook_url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json; charset=UTF-8',
"X-Mya-Signature: $signature"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$webhook_response = curl_exec($ch);
curl_close($ch);
{warning.fa-close} No services shall be provided. Don't forget to update your database.