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
<?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);
}
{
"code": "00",
"message": "SUCCES",
"data": {
"amount": "100",
"currency": "XOF",
"status": "ACCEPTED",
"payment_method": "OM",
"description": "Paiement abonnement",
"metadata": null,
"operator_id": "MP220915.2257.A76307",
"payment_date": "2022-09-15 22:57:15",
"fund_availability_date": "2022-09-17 00:00:00"
},
"api_response_id": "1663323067.7677"
}
{
"code": "627",
"message": "TRANSACTION_CANCEL",
"data": {
"amount": "100",
"currency": "XOF",
"status": "REFUSED",
"payment_method": "MOMO",
"description": "Test de paiement demo CinetPay",
"metadata": null,
"operator_id": null,
"payment_date": " ",
"fund_availability_date": "2022-09-08 00:00:00"
},
"api_response_id": "1663323224.8402"
}