0

I'm trying to integrate PayFast Payment Gateway (Custom) into my ReactJS and NodeJS App. In ReactJS App, I'm only creating "Checkout Form" and calling Sandbox URL with ID, Key, Notify URL, Return and Cancel URL. In NodeJS App, I'm creating a Endpoint (Webhook) where I expected to receive Transaction Webhook Payload but I didn't receive ITN Payload in req.body.

Anyone can help me ?
Note: I already using ngrok to access my localhost publicly with https.

Thanks

Already write the code according to documentation.

1 Answers1

0

As for me, I submit my form inputs to my node.js backend, generate the identifier by calling the payfast see docs from the node.js app. (I did this from the server because to avoid having my merchant_id in react which is insecure). Payfast will respond with a uuid, which I sent back to my React app. You then use this uuid to generate the payment model:

window.payfast_do_onsite_payment({
   uuid: '<response_from_payfast>',
   cancel_url: '<your_cancel_url>',
   return_url: '<your_return_url'
})

This will open up a modal, and you can make a payment. Keep in mind that you have to add the payfast js bundle to your react app <script src="https://www.payfast.co.za/onsite/engine.js"></script>