For this section we will use the PayPal Standard gateway as an example, but you will probably want to start with the existing gateway that most closely matches the one you want to implement.
Each gateway illustrates different techniques that you may need. The following table summarises some of the techniques used by each gateway.
| Gateway | Techniques |
|---|---|
| Offline | This is a very simple gateway since there is no communication with any external entity. Depending on the configuration, the payment button either shows a modal popup with confirmation text and a confirmation button, or the payment button simply redirects to a function within the addon that sets the required payment status and returns to the calling application. |
| PayPal Standard | Uses Curl to communicate with PayPal, using either the PDT API or the IPN API to verify the payment, whichever is triggered first. Subsequent IPN notifications are passed on to the application. |
| PayPal Checkout | Uses Curl to communicate with PayPal. When the user clicks the payment button, the Javascript calls a function in the addon which creates a PayPal order using the PayPal REST API, and returns the order ID to the Javascript, which returns it to the PayPal Javascript. The PayPal Javascript then renders the relevant buttons and handles the interaction with the buyer in an iframe. When payment is complete the Javascript again calls the addon to verify and store the payment information, and redirect the user back to the calling application's post-payment page. |
| SagePay | Performs additional validation of the name and address data provided by the application, rejecting the button request if the data is invalid. Uses AES to encrypt the payment parameters included with the payment button request, and decrypts the response from the gateway. |
| Mollie | Uses the Mollie PHP library to call the Mollie API. When the user clicks the payment button, the user is invisibly redirected back to a function in the addon because the payment needs to be initiated via the Mollie API before the browser is redirected to the Mollie payment pages. After the return from the gateway, the Mollie API is used to retrieve the payment status. |
| Stripe Checkout | Uses the Stripe PHP library to call the Stripe API. When the user clicks the payment button, an Ajax call back to the addon is used to create a Stripe Session using the Stripe API. The Ajax response triggers a call to the Stripe Javascript, which redirects the user to the Stripe payment page. Two different Webhooks are processed. Uses a special flag to tell the Payage front end that it does not need a TID to be included on a request. |
| Worldpay Redirect | Since WorldPay does not handle a 303 redirect, this gateway outputs a special page to the browser, so that the browser redirects back to the calling application. |
| Barclaycard ePDQ | Uses HTTP GET and POST requests to communicate with Barclaycard, and uses various hashing and hash verification techniques. |
| Authorize.Net | Uses Curl and XML to interface with the Authorize.Net API. Obtains a form token from the gateway, then uses a post request from the browser to populate an iFrame in a modal popup. Custom Javascript receives messages from the form and uses Ajax to communicate back to Payage. |
Some of the discontinued gateways show techniques not used in the current gateways, so they are still available to download as examples.
| Gateway | Techniques |
|---|---|
| Stripe Legacy | Uses the Stripe PHP library to call the Stripe API. Loads Stripe's Javascript on the payment page and constructs customised Javascript to handle a click on the payment button. Also uses the Stripe API to process and verify the payment. Uses a special flag to tell the Payage front end that it does not need a TID to be included on a request. |
| Worldpay Online | Uses the Worldpay PHP library to call the Worldpay Online API. The payment button redirects to a function in the addon that displays the payment form on a new page of the host site. Another function uses the Worldpay code to create the payment using the token returned by the Worldpay Javascript. |
| PayPlug | Uses OpenSSL to sign the button parameters with the account private key, and uses a public key to verify JSON returned by the IPN message returned. |
| Skrill | Uses Curl to communicate with Skrill and implements Skrill's Merchant Query Interface (MQI) interface. |
| BitPay | Uses the BitPay PHP library to call the BitPay API. When the user clicks the payment button, an Ajax call back to the addon is used to create a BitPay Invoice using the BitPay API. The Ajax response optionally loads a modal popup form to collect the user's name and email address using a modal popup, then submits the Invoice to BitPay. Handles JSON IPN messages from BitPay. Handles a one-time pairing between the account and the gateway. |