Third Party Gateway

Follow the steps below to create a third party gateway module.

A Third Party Gateway module is one where a customer leaves the site to pay and returns when the payment process is complete. Examples include PayPal Standard and 2Checkout.

Implementation Guide

  • Delete the yourmodulename_capture function from the module template since this is only required for Merchant Gateway modules.
  • Define and return the HTML code that will forward the user to the payment gateway to complete the payment process inside the yourmodulename_link function. This is typically done by way of an HTML form utilizing the POST method.
  • Optionally, if your payment gateway supports sending notifications upon successful receipt of payments, create a yourmodule_callback function to receive and handle those.
  • If your payment gateway supports refunds, implement support for Refunds.

Variables

The following parameters are passed to the yourmodule_link function along with all defined configuration parameters and their values.

Response Format

The _link function should return an HTML code block that can be rendered to the user. This should typically take the format of an HTML form.


Simple Example

Below is a very simple demonstration of a link function that forwards the end user to https://gateway_domain.com/checkout using a form post containing the invoice data. For a more complete example, please refer to the Sample Third Party Gateway module on Github.

<form action="https://gateway-domain.com/checkout/" method="POST">
  <div class="row">
    <div class="col-md-4">
      <!-- amount (Enter Amount HERE) -->
      <input type="hidden" name="amount" value="'.$amount.'">
      <!-- currency (PKR,USD) -->
      <input type="hidden" name="currency" value="'.$currencyCode.'">
      <!-- succes_url (User will redirect if payment complete) -->
      <input type="hidden" name="succes_url" value="'.$systemUrl.'/client/paytoinvoice/'.$gateway_id.'/'.$invoiceid.'">
      <!-- cancel_url (User will redirect if payment Not Complete) -->
      <input type="hidden" name="cancel_url" value="'.$systemUrl.'/client/paytoinvoice/'.$gateway_id.'/'.$invoiceid.'">
      <!-- client_email (After Complete payment CM sent Confirmation EMail to Client) -->
      <input type="hidden" name="client_email" value="'.$email.'">
      <!-- web_id (Your web id you can find this on CM panel) -->
      <input type="hidden" name="web_id" value="'.$web_id.'">
      <!-- Unique Order Id (You will get this order id after payment success (Optional) (Max 80 Character Allowed)) -->
      <input type="hidden" name="order_id" value="'.$invoiceid.'">
      <!-- Additional info (additional information (you will get this value after success payment) (Optional) (Max 80 Character Allowed)) -->
      <input type="hidden" name="addi_info" value="'.$description.'">
      <button type="submit" class="btn btn-success"><i class="glyphicon glyphicon-credit-card"></i> Pay Now</button>
    </div>
  </div>
</form>