Instant Transaction Notification (ITN)
Overview
Instant Transaction Notification (ITN) is a method of notifying a receiver about transactions on the PayFast system through a browser independent, backend notification. It allows a receiver to integrate PayFast payments with their website's backend operations.
It provides immediate confirmation of payments you receive and is not subject to connection interruptions or user browser interaction. It also employs queuing and acknowledgement to ensure that temporary interruptions do not influence operations.
How it works
When a payment is processed for your account by PayFast, ITN is triggered immediately upon successful completion of the payment (if enabled).
PayFast will do an HTTP FORM post of the transaction information to the notify_url specified by the receiver (either globally on your account, or per transaction).
This information must then be validated to ensure that it is correct and valid. This is done by doing an HTTP FORM post back to the PayFast server, which will respond with either "VERIFIED" or "INVALID".
A "VERIFIED" response indicates that the information is correct and originated from the PayFast server. An "INVALID" response should be investigated to determine the cause. It could be caused by an ITN error (eg. due to changing formats) so you should investigate your code firstly, but it could also be due to malicious action.
Once you have verified that the information is valid, you should check the following:
- Check that the payment_status is COMPLETED.
- If the payment_status is COMPLETED, check the pf_payment_id against previous PayFast payments you have processed to ensure it is not a duplicate.
- After you have checked the payment_status and pf_payment_id, make sure the merchant_id is the correct ID for your account.
Variables
Variables used for ITN are available here.
Sample Code
Sample code for ITN is available on the help site.