How to create new Payment Gateway

Note*:

  • Gateway must be inited after init wordpress hook
  • We use Omnipay Library for Paypal Example Gateway

Example Paypal:

 

Explain:

  1. Gateway ID:  protected $gateway_id='paypal';
  2. Gateway Infomation and Gateway Settings:

3 . Show Paynow Button in Order Detail Page (Only in case Status is Payment-fail)

4. Function do_checkout():  Do checkout After Order was created, you can return redirect url, status of current Gateway

  • Param: Order_id
  • Return Array:  return array('status' => 1, 'redirect' => $response->getRedirectUrl());

5. Function complete_purchase(): Run right after redirect from Gateway Website to our website, you can validate and check if the payment is success here

  • Param: Order_Id
  • Return bool