Payfast Gateway encryption key update

Update your Payfast Gateway encryption key in a custom integration

All platforms

For merchants whose website, app or billing system connects to Payfast Gateway directly through PayWeb, PayHost or PayBatch, and not through one of our plugins.

Who this is for

This applies to you if your website, app or billing system was built to connect to Payfast Gateway (previously PayGate) directly, and not through a shopping cart plugin. Please pass these instructions to the developer or company that built or maintains that connection.

Before you start

  • Have your new encryption key ready. You generate it in the Merchant Access Portal, as set out in the security update email from Payfast.
  • Payfast Gateway holds a separate key for each product on your account: PayWeb, PayHost and PayXML. PayBatch uses the PayXML encryption key. Check with your developer which of these your systems use.
  • The key in your systems must match the key on your Payfast Gateway account. Payments will fail while the two are different, so agree a time with your developer and make the change as soon as your new key is active.
  • Your Paygate ID does not change.

What your developer needs to do

These two videos show the change for PayWeb, using the sample code from the Payfast Gateway developer docs. Your own code will look different.

PHP

Node.js

  1. Find every place where the current key is stored. It is usually in one of these: a configuration file, an environment variable, a secrets store, a settings table in the database, or a payment settings page in your own admin area.
  2. Check for other systems that use the same Paygate ID. Examples are scheduled jobs, a subscription or invoicing tool, a refunds tool and the back end of a mobile app. Each one needs the new key.
  3. Replace the old key with the new key in each place, with no spaces or line breaks before or after it.
  4. Restart or redeploy the application so that it loads the new value. Clear any configuration cache.
  5. Make a small live payment and follow it to the end: the payment page opens, the customer is returned to your site, and the order or invoice is marked as paid. If you use refunds, queries or batch uploads, test one of each.

Where the key is used, by product

This part is for the developer.

  • PayWeb (PayWeb3): the key is the last value added to the string that is hashed into the MD5 CHECKSUM. It is used to create the checksum on the Initiate, Redirect and Query requests. It is also used to check the checksum that Payfast Gateway sends back: in the Initiate response, in the post to your Notify URL and when the customer returns to your Return URL. All of these must use the new key.
  • PayHost: the key is the Password sent in the Account block of every SOAP request, next to the PayGateId. This includes payment, query, settlement, refund and vault requests. If you use the PayHost redirect, the same value is used for the checksum on the redirect and on the customer’s return.
  • PayBatch: PayBatch uses your PayXML encryption key. It is the password that your system sends with every PayBatch web service request, with your Paygate ID as the username. If you only upload batch files by hand in the Merchant Access Portal, there is no key in your own systems to change.

The developer documentation is at https://docs.paygate.co.za.

If payments fail after the change

  • If PayWeb returns the error DATA_CHK, the checksum was calculated with a key that does not match your Payfast Gateway account. Check that the new key was saved exactly as supplied and that the application was restarted.
  • If PayHost or PayBatch requests are refused, check the password that is being sent with your Paygate ID.
  • If customers can pay but your orders or invoices are not marked as paid, the part of your system that receives the Notify or Return message is still using the old key.
  • If payments still fail, contact Payfast support: email [email protected], call 021 300 4455 or use the live chat on payfast.io.

← All platforms

Need help? [email protected] · 021 300 4455

Last updated 21 November 2026