10. Sandbox Tools

What is the PayFast Sandbox

Testing the PayFast service makes use of a sandbox strategy, which is to say that there is an exact code duplicate of the production site available in a sandbox environment. Any transactions made or actions performed on this system are isolated from the main production environment and as such it provides a realistic, but inconsequential environment where merchants can test their system before making use of the live transacting service.

How to use the Sandbox

The sandbox provides you with tools to:
A. Check the POST variables, security signature and recurring billing.
B. Test your PayFast integration.

A. Check POST Variables

The sandbox URL is https://sandbox.payfast.co.za, and it allows you to:

  1. Take a tour of the sandbox so you can familiarize yourself with it.
  2. Test the POST variables and determine what the security signature should be.
  3. View the response the ITN received from your server.
  4. Add a passphrase.
  5. View test subscriptions and ad hoc agreements.

1. The Tour

The tour provides you with a step by step guide on how to use the POST CHECK and ITN tools. The merchant ID and Key provided are those registered to your sandbox account.

2. POST CHECK

The POST CHECK ‘Signature Generator’ tool allows you to determine the signature that should be generated. This is done by inserting the parameter string into the tool and clicking on ‘Generate Signature’.

The ‘Post Check Form’ tool allows you to test the variables that will be POSTed to PayFast. You can check the ordering, value lengths, if there are any missing fields, as well as the signature generated.

3. ITN

The ITN tool allows you to view the ITNs sent to your server, and the response that we received from your server.

4. SETTINGS (Passphrase)

Under settings you can set the passphrase. This would be the ‘password’ that is necessary in order to generate the correct security signature.

5. Recurring Billing

Test subscriptions and ad hoc agreements can be viewed as shown, once the test payment is completed. It is possible to cancel and charge both test subscriptions and ad hoc agreements (when charging, the ITN is viewed as mentioned above), as well as pause and edit subscriptions. When editing a subscription you can change the amount, number of cycles (payments), next payment date and the frequency.

B. Test PayFast Integration

The PayFast sandbox allows you to test your PayFast integration without any money exchanging hands. In order to do this you can set the PayFast module on your site to sandbox/test mode, in the case where a PayFast module is used, otherwise, if developing a custom integration, you can change the redirect URL to the sandbox site (https://sandbox.payfast.co.za/eng/process). In this instance you will also need to change the validate URL, in your notify URL script, to the sandbox site (https://sandbox.payfast.co.za/eng/query/validate). In both cases you will need to use sandbox credentials (which can be obtained from your sandbox account, or from the ‘Testing‘ page . Please note that if you want to view the ITNs as mentioned above you will need to use your sandbox credentials.

When conducting a test transaction on your site, you will be redirected to the PayFast sandbox. You may need to enter user credentials, which are as follows:
Username: sbtu01@payfast.co.za
Password: clientpass

Once off Payment

Once you are logged in (either automatically by the system, or after entering the above credentials) to PayFast you will see the below screen, stating that you are in the sandbox/test environment, with the amount given for the transaction, and a PayFast wallet (which is reset to R99,999,999.99 every night). You can complete the test transaction by clicking on ‘Pay Now Using Your Wallet’. The ITN will then be sent to the notify URL before you are redirected to the return URL. You will then be able to view the ITN as mentioned in section A.3 above, if you used your sandbox credentials.

Recurring Billing

Once you are redirected to the PayFast sandbox you will see one of the below screen (either for a subscription or ad hoc agreement), describing the subscription, as well as providing you with a test credit card and cvv number. In order to make the test payment select the credit card and enter the cvv number provided and click on ‘Pay’. The ITN will then be sent to the notify URL, before you are redirected to the return URL. You will then be able to view the ITN as mentioned in section A.3 above, if you used your sandbox credentials.

Subscriptions

Ad Hoc Agreement