What causes the error "The supplied variables are not according to specification"?
This error is thrown if any of the POSTed values are incorrect, for instance, if the merchant_id or merchant_key is incorrect (possibly due to using a sandbox credentials on the live site), the following error will be thrown ‘The supplied variables are not according to specification: merchant_key: Merchant key is invalid’. The error will highlight which variables are incorrect or missing, you will then need to ensure that the POST form is adjusted accordingly.
When the error shows "cancel_url: must be a valid URL, notifyl_url: must be a valid URL, return_url: must be a valid URL", please bear in mind that Payfast does not accept local URLs, and will produce this error for a locally hosted site. This is because there is no server to server communication so the ITN will never hit the notify URL. Once the site is web accessible then these errors will disappear.
In the meantime, you can try use "127.0.0.1" instead of "localhost" or set up a DNS host file for the local site so that the url becomes "http://www.mysite.local" instead of "http://localhost/mysite".
A tunneling service like
https://ngrok.com/ can also be used. It will allow you to connect your local host to the internet.
Related Articles
In Shopify why am I receiving 'Error: The supplied variables are not according to specification: currency'?
Unfortunately, Shopify currency conversion with PayFast does not work. The foreign currency amount comes through as ZAR amount because Payfast only transacts in ZAR. You will need to ensure that the shop currency is set to ZAR.
What causes an invalid URL error?
The Payfast system will pick up on ‘local’ or ‘localhost’ in the return, cancel and notify URLs and throw the invalid URL error. This is because it is not possible to test the ITN locally due to no server to server communication. The site needs to be ...
What causes the ITN security check errors?
Invalid signature This would be caused by the incorrect use of the passphrase, or the incorrect order of variables in the string that is MD5 hashed to generate the signature. Although this signature is generated in the same way as the signature on ...
Common causes of a failed integration / signature mismatch
The following will cause a signature mismatch or a payment to fail: This is most likely caused if you generated the MD5 hashed string with the variables in the wrong order. A required field is missing. A field is greater than the allowable character ...
Can I send my custom variables to sandbox and get a response?
Yes, you can send custom variables that will be returned on the notify_url, after a successful transaction from the sandbox. However, if you are testing locally, you will not receive the ITN as it will be unable to reach your local server.