Hello house,
I am trying to add a local payment gateway as a payment option on a wordpress e-commerce website powered by WPGroupBuy deals plugin.
WPGroupbuy comes with a couple of in-built payment gateways: Paypal, Stripe and Payfast.
Fortunately, I found that Payfast (a South-African payment gateway) has a payment flow very similar to that of the payment gateway I want to integrate to:
PAYMENT FLOW
1. Send transaction information from e-commerce website to gateway by redirecting the customer to gateway payment page;
2. After payment is completed by customer, gateway redirects customer back to e-commerce website (return_url) with unique transaction reference;
3. E-commerce website queries a web service from gateway for payment status;
4. E-commerce website updates own database based on information received from gateway in step 3 and displays payment status message to customer.
---------------------------
Now, I was able to modify the Payfast code to the extent that 1 and 2 can be achieved for the local gateway.
However, I'm stuck on handling the payment feedback portion of the work. There's some portion of the Payfast code that seems to handle this, but I don't have an idea what URL triggers this portion of the code.
There's this method that I'm sure is the one responsible:
/**
* Handle a received IPN.
*/
public function back_from_payfast() {
do_action('payment_handle_payfast', $itn);
if ( self::returned_from_offsite() ) {
if ( self::pdt_validation($_GET['pt']) ) {
$_REQUEST['wg_checkout_action'] = 'back_from_payfast';
}
}
}
And the trigger for the method is:
// Handle the return of user from pxpay
add_action('wg_load_cart', array($this,'back_from_payfast'), 10, 0);
I need to know the URL that will trigger this action, because that will need to be supplied to gateway as return_url.
Thanks for reading through and thanks in advance if you can help.