Reputation: 11
I have created a website that needs to use payfast as it's payment gateway. I have managed to send the data and do the test payment but it doesn't seem to be sending me back anything to the notification url. Either it is sending and there is an error that i can't debug because you can't use your local machine as the return urls. Or it's not sending at all so it's quite impossible to say. I'm using the c# code from the sample on their page so it's supposed to be straightforward. Can anyone suggest how i can test my notify page or if someone could check the code maybe i'm doing something silly.
Upvotes: 1
Views: 2305
Reputation: 1
One of the reasons that I have found is that there needs to be a proxy in front of your service. In my case, I was using AWS API Gateway and assumed that the Stage URL would be enough for the notify_url to send to. I had to place my AWS API Gateway behind Cloudfront first in order for this to work. To test locally, I used ngrok as the proxy.
Upvotes: 0
Reputation: 574
The most likely cause of this issue is that PayFast is unable to hit your notify_url
.
The notify_url
must be publicly accessible, and return a header 200
response, in order for PayFast to be able to post back the return variables to your system, as per their documentation.
The best way to test the ITN callback method, would be to create a sandbox account. Using the sandbox credentials provided after creating the account, you can perform a test payment, after which an ITN will be sent to your notify_url
.
The ITN sent after the successful sandbox transaction will be shown on the sandbox dashboard. You will then be able to view the response PayFast received when attempting to post back the return variables to your notify_url
.
This information can then help you determine if there an issue with your notify_url
(such as a 404, 500, etc).
As a side note:
You can use a tunnelling service, such as ngrok, to test your integration with PayFast on your local system. As per their docs (which are straight forward):
ngrok allows you to expose a web server running on your local machine to the internet
Upvotes: 1