How to collect POST notification about transaction?
Our system sends an asynchronous POST to your endpoint (within 1-60s after successful payment) which you can set:
- Static at merchant panel, under settings->notifications->result url
- Dynamic, by sending "result_url" within other transaction parameters
After setting your endpoint address, you should place there a script which will collect all information.
After each transaction, our system automatically sends a notification containing payment details (amount, status, date, crc, etc.). Each received request should be validated on several levels:
- validation of the IP address of the server from which the notification was sent,
- validation whether the sent parameters are consistent with the data that was sent to the payment service (amount, crc),
- validation whether the checksum sent under the key 'md5sum' is correct,
- validation whether such a transaction has not been confirmed before.
If everything is correct then the script should return only word 'TRUE'. This answer is interpreted by the system and marks the notification status as delivered.
However, if any of the validation elements are not met, return the text 'FALSE' or an error message that has occurred. Such an answer is interpreted by the system as incorrect and the notification will be sent once again according to the schedule.
In case when the seller supports two-step payment acceptance, the answer 'FALSE' will be interpreted as the decision to return the transaction to the customer. In this situation, you should distinguish between payment notification, which you do not want to accept or incorrect notification, so it is best to return the message with an error.
In summary, if the notification request is incorrect, it is a mistake to display the 'TRUE' text as a response.
Please see the example of ready to use script in our PHP library https://github.com/tpay-com/tpay-php/blob/master/tpayLibs/examples/TransactionNotification.php
Our library returns validated array, containing all transaction parameters which you should use to update order status and other stuff your need.
You can find more details about notifications at our documentation https://docs.tpay.com/#!/Tpay/tpay_notifications
Please note, the success page is not related with payment confirmation. The Success page is only the url where the customer is being redirected after successful payment.