Checking a transaction


Check out a transaction

To know the status of a transaction, you must send the following information in JSON format.
Using this url:

https://sandbox.transfluo.com/checkout
  • apikey : your apikey
  • merchant_id : your merchant_id
  • order_id : your order_id

Request PHP

<?php

   $payload = [
        "merchant_id"  => 'YOUR_MERCHAN_ID',
        "api_key"      => 'YOUR_API_KAY',
        "amount"       => '10500', // XAF for payload
        "order_id"     => 'ORDER_ID',
        "redirect_url" => 'WHERE_YOUR_WILL_REDIRECTED_AFTER_PAYMENT'
    ];

    // Encrypt payload using crypto helper provided after account activation
    $this->load->helper('crypto');
    $token = encryptPayload($payload);

    // Redirect to TransFluo checkout to finalize the payment
    $payment_url = rtrim('https://Sandbox.transfluo.com/checkout', '/') . '?token=' . urlencode($token);
    redirect($payment_url);

Example of a successful response


     
    $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);

Example of an error response

 
     
    $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);