Payment Data Transfer (PDT)
Overview
If PDT is enabled for a business account, when the user is returned to the return_url following successful payment, a payment token is appended to the return URL. This payment token must be used, in conjunction with your PDT key, to query PayFast for the payment details.
How it works
A PDT request is an HTML POST of two variables: pt and at where pt is the payment token received as a FORM GET variable from the return_url and at is your authentication token (PDT key) obtainable from the My Account page.
The response to a PDT request will be an HTTP 200 / OK response with the first line being either "SUCCESS" or "FAIL".
If you receive a SUCCESS response, the lines following will contain the details of the transaction in key-value pairs (one per line) where both the key and the value are URL-encoded. This response needs to be parsed correctly and URL-decoded.
If you receive a FAIL response, it is an indication that the request failed and we recommend verifying that the:
- the Payment token is not bad, and
- the Authentication token is not bad.
Note: The SUCESS or FAIL is an indication of the success or failure of the PDT request and NOT the payment itself! You must check the returned data to determine the status of the payment.
Variables
Variables used for PDT are available here.
Sample Code
Sample code for PDT is available on the help site.