The notification link/url is called by CinetPay to notify you of the status of a payment. This url must be available to accommodate HTTP requests of type GET and POST and return statut HTTP 200 OK . CinetPay will not post any data via GET, the server pings your url to make sure it is available
The notify_url must be the only mechanism to implement to automatically synchronize payments to your merchant site. CinetPay will call this link after each update to notify you of status changes during a transaction.
At the end of a payment, CinetPay systematically calls the notification url for the concerned service. This call aims to inform the merchant site of the payment status (even if the customer does not return to the site). The merchant will then be able to validate the order if the payment is verified and accepted.
The notification url is not necessary if you don't need to have the payment status in your database, as you have the payment history in your CinetPay backoffice.
Ex: Donation collection application.
The server executes a POST request containing :
Headers:
Form values:
you will have to collect mainly cpm_trans_id and cpm_site_id posted by CinetPay for the continuation of the configuration.
To ensure the integrity of the data you are processing, you need to perform some checks:
After getting it, you have to check in your database that the status of the payment concerned is already successful:
To know the status of a transaction, you must send the following information in JSON format.
Using this url: https://api-checkout.cinetpay.com/v2/payment/check
for more details, please see the section Transaction verification
NB: Payment confirmation for some operators is via push notification , your system receives an initial notification with the status WAITING_FOR_CUSTOMER. This status describes the payment that is awaiting payment approval by the user. If you update the payment as a definite failure, this explains why payments made with these made with these operators are not properly processed by your system.
When the payment is successful, you will receive this response from CinetPay:
{
{
"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"
}
{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 CinetPay:
{
"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"
}
{warning.fa-close} No services shall be provided. Don't forget to update your database.
After payment, you can test your notification url using an http request application. For the example, we will use PostMan
.
Available GET
1) Enter your return url
2) Select the GET method, then click on "Send
3) You should receive Status 200 OK(If this is not the case, you will find the cause here )
Available POST
1) Enter your notification url
2) Select the POST method
3) Select the content-type x-www-form-urlencoded
1) Enter cpm_trans_id and cpm_site_id with their respective values, then click on "Send".
4) You should receive Status :200 OK(If this is not the case, you will find the cause here )
This usually happens when your notification url is not accessible or misconfigured. The table below summarizes the likely reasons why you are not receiving a notification.
Using an HTTP request app like PostMan
you can test your notification url.
But first, make sure your notification url is available in GET and POST and accessible by a public server.
If the error obtained is not in the table below, write to us at this address:
support.technique@cinetpay.com
Code | Cause | Solution |
---|---|---|
Status: 404 | your url was not found | Check that the url entered is correct. |
Status : 419 | This error is unique to Laravel and is due to the crsf . In Laravel it is mandatory the token at each POST |
If you do not want to send token, deactivate this check; Mention the name of your method in the app/http/middleware/VerifyCsrfToken.php file. |
Status : 403 not permission | This happens when the URL used for the request does not match a route defined on your API gateway. | |
Status : 504 Gateway Timeout | This error indicates that the server, acting as a gateway or proxy, did not get a response in time from an upstream server to complete the request |