Vérification d'une transaction


Vérifiez une transaction

Pour connaître le statut d'une transaction, vous devez envoyer les informations suivantes au format JSON.
En utilisant cette url :

https://api-checkout.cinetpay.com/v2/payment/check
  • apikey : votre apikey
  • site_id : votre site_id
  • transaction_id : votre transaction_id ou token : Le payment_token obtenu lors de l’initialisation du paiement

Requête PHP

<?php

    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => 'https://api-checkout.cinetpay.com/v2/payment/check',
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_ENCODING => '',
      CURLOPT_MAXREDIRS => 10,
      CURLOPT_TIMEOUT => 0,
      CURLOPT_FOLLOWLOCATION => true,
      CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
      CURLOPT_CUSTOMREQUEST => 'POST',
      CURLOPT_POSTFIELDS =>'{
        "transaction_id":"", //ENTRER VOTRE TRANSACTION ID
        "site_id": "", //ENTRER VOTRE SITE ID
        "apikey" : "" //ENTRER VOTRE APIKEY

    }',
      CURLOPT_HTTPHEADER => array(
        'Content-Type: application/json'
      ),
    ));

    $response = curl_exec($curl);

    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
      echo $err;
      //throw new Exception("Error :" . $err);
    } 
    else{
     $res = json_decode($response,true);
       print_r($res);
    } 

Exemple de réponse succès

{
    "code": "00",
    "message": "SUCCES",
    "data": {
        "amount": "100",
        "currency": "XOF",
        "status": "ACCEPTED",
        "payment_method": "OM",
        "description": "GFGHHG",
        "metadata": null,
        "operator_id": "MP210930.1743.C36452",
        "payment_date": "2021-09-30 17:43:30"
    },
    "api_response_id": "1633023959.8459"
}

Exemple de réponse échec

{
    "code": "600",
    "message": "PAYMENT_FAILED",
    "data": {
        "amount": "100",
        "currency": "XOF",
        "status": "REFUSED",
        "payment_method": "OM",
        "description": "GFGHHG",
        "metadata": null,
        "operator_id": null,
        "payment_date": " "
    },
    "api_response_id": "1633024200.1830"
}