I’m wondering if you could help me. I’m working on a custom payment gateway integration with WooCommerce and I’m stuck now. The moment I click on pay I get a 500 Internal Server error in Chromes console and it gets stuck in the receipt page.
You can check the code I got so far here
https://github.com/tora-soft/visanet-uy-payment-gateway/blob/master/visanet-uy-payment-gateway.php
It is supposed to generate an html form and make a POST to the payment gateway where the user would enter his/her CC details and then come back. This is working now
UPDATE Aug 15th
Now the post is working but when coming back from the payment gateway is landing on a default checkout page and is not processing the result.
Any help would be appreciated.
Thanks in advance.
@Federico You should not rely on the user pressing “return to website” to receive the payment response payload. you should rely on the IPN response talk from their backend to your backend. your payment provider tells the user the payment is successful and the user closes the browser.
Step 1. When redirecting the user to the VisaNetUY, make it return back on the Thank You URL.
Step 2. Give this URL to your payment gateway so that it can notify your website when a transaction has approved. (sometimes known as webhook or ipn response)
Step 3. You need to remove this line.
Step 4. and use this line instead:
Step 5. Don’t call $order->reduce_order_stock() because $order->payment_complete() already does the reducing stock, and changing status for you.