0% found this document useful (0 votes)
353 views

Payment Gateway Integration Tutorial For Developers - Emerchantpay

Uploaded by

KF
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
353 views

Payment Gateway Integration Tutorial For Developers - Emerchantpay

Uploaded by

KF
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

Payment gateway integration tutorial for


developers
By Marketing
04 October 2019

The ultimate guide for integrating a payment gateway with your online businesses. JavaScript & Server Side Tutorials | Shopping
Cart Tutorials

In this article you will find

Steps before integrating

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
   Quick
information, check integration

out our Cookie policy.


   Common integration steps

I AGREE CHANGE SETTINGS


   Prevent form submit action

https://www.emerchantpay.com/insights/payment-gateway-integration/ 1/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

   JavaScript only

   Server side integration

Payment gateway integration tutorial in PHP

Payment gateway integration tutorial for Java

   Payment gateway integration with WordPress (WooCommerce) tutorial

   Payment gateway integration with OpenCart tutorial

   Payment gateway integration with PrestaShop tutorial

Testing

The process of integrating a payment gateway may seem daunting, but if you want your website to accept online payments it is
necessary. Payment gateways connect the merchant’s website and their payment processing bank, allowing for the secure
transference of financial details. This is usually done by encrypting the details of credit cards, or other payment methods. In this
article, we will provide a step by step instructions for multiple types of integration methods. Throughout, we will be using our
payment gateway, Genesis, as an example. Before we get to the nitty gritty of the integration process, we first need to take a look at
the steps that need to be in place beforehand.

Steps before integrating


The first stage in the journey to integration is the completion of a Merchant Application Form (MAF). The MAF lists the
documentation that needs to be provided (including, but not limited to, incorporation documents, utility bills, copies of passports
and bank statements) and handed over to the underwriting team who will then perform the necessary checks. Once everything is in
place the agreement can be signed. Before the gateway can go live, tests need to be undertaken to ensure that all transaction types
can be processed smoothly. To complete these tests, the gateway needs to be integrated following the steps detailed below.

Quick integration
Before we start with different integration methods for the different programming languages, there is an option for a super quick
and simple integration. If this fits your requirements, keep reading. If not, you can skip to the next section.

We provide you with the option to generate and redirect the users to a hosted payment form
You can embed it

Please note: integrating the gateway by following the below steps is a more advanced. However, you can achieve similar results
with the above described, if it fits your business model.

Common integration steps


Regardless of the programming language used to create your website, the first three steps to integration are the same.

1. Download the source files from Github

PHP- https://github.com/GenesisGateway/genesis_php

Java- https://github.com/GenesisGateway/genesis_java

Java Android SDK- https://github.com/GenesisGateway/android_sdk

Node.js- https://github.com/GenesisGateway/genesis.js

2. You will need to sign a contract in order to receive your username, password and token
3. Client-side integration: you will need a HTML form to collect credit and debit card information.

First, the merchant needs to create a payment form integrated with the Client-Side Encryption (CSE) library. This can be retrieved
from the CSE panel in the merchant console on the merchant configuration page.
We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
It is important
information, check out ourtoCookie
makepolicy.
sure that the payment form contains all the required fields for the transaction types that are going to be
used. If you are unsure, consult with our Transactions documentation. Don't forget to replace the form action with the payment
I AGREE CHANGE SETTINGS
handler URL of the merchant's server.
https://www.emerchantpay.com/insights/payment-gateway-integration/ 2/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

Flag all card input fields for encryption by annotating them with the data-encrypted-name attribute. The name attribute should not
be used for card input fields. The fields allowed for encryption are card_holder, card_number, expiration_month, expiration_year, and
cvv.

Use the "data-encrypted-name" attribute for card input fields. This technique protects the merchant's server from receiving
unencrypted card data and avoids any impact on the transaction security and PCI regulations compliance.

The form may have a custom ID attribute. The formId option can be used to set any string as an ID for the payment form. Make
sure to update the HTML form with the configured option and be careful to check that they both match.

Prevent form submit action


In the case of a single-page application or a form that uses AJAX, it may not be required for the form to reload the page when the
payment gets submitted. For that reason, we provide onSubmit option. This option gives access to all the form data (including the
encrypted fields) and allows submission via any AJAX library.

Encrypto.createEncryptedForm(publicKey, {

onSubmit: function(form) {

// console.log(form.fields);

})

JavaScript only
In the instance that the merchant does not have an HTML form, our library provides HTML-independent encryption. In this scenario,
it's important to remember it's the merchant’s responsibility to make sure that the card data is encrypted before being sent to the
server.

<head>

...

<script src="https://{CDN}/encrypto-{VERSION}.js"

integrity="sha512-lJxHl93A/b8peqxz/mdLj7jD58N2zvHiiYhw8...=="

crossorigin="anonymous"></script>

</head>

<body>

<script>

var publicKey = '...';

var cse = Encrypto.createEncryption(publicKey);

let data = {

cvv: '123',

card_number: '42000...'

};

var encryptedData = cse.encrypt(data);

</script>

</body>

Server side integration


We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.

From the merchant's server, an HTTP POST request needs to be made to the gateway API endpoints. The workflow is the same as
I AGREE CHANGE SETTINGS
in the classic Client Integrations. The only difference is that when the Client-Side Encryption (CSE) library is used, our gateway will
i th dd t t d
https://www.emerchantpay.com/insights/payment-gateway-integration/ 3/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
receive the card data encrypted.

After this, the steps differ for each language and we will explain the requirements needed for them all.

Payment gateway integration tutorial in PHP


Getting Started
By following the code below you will be able to start the integration process. Please note that the file vendor/autoload.php is
located inside the directory where you cloned the repo and it is auto-generated by Composer. If the file is missing, just run the php
composer.phar update inside the root directory.

<?php

require 'vendor/autoload.php';

// Load the pre-configured ini file...

\Genesis\Config::loadSettings('/path/to/config.ini');

// ...OR, optionally, you can set the credentials manually

\Genesis\Config::setEndpoint(\Genesis\API\Constants\Endpoints::EMERCHANTPAY);

\Genesis\Config::setEnvironment(\Genesis\API\Constants\Environments::STAGING);

\Genesis\Config::setUsername('<enter_your_username>');

\Genesis\Config::setPassword('<enter_your_password>');

\Genesis\Config::setToken('<enter_your_token>');

// Create a new Genesis instance with desired API request

$genesis = new \Genesis\Genesis('Financial\Cards\Authorize');

// Set request parameters

$genesis

->request()

->setTransactionId('43671')

->setUsage('40208 concert tickets')

->setRemoteIp('245.253.2.12')

->setAmount('50')

->setCurrency('USD')

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
// Customer
information, check out ourDetails

Cookie policy.

->setCustomerEmail('[email protected]')

I AGREE CHANGE SETTINGS

(
https://www.emerchantpay.com/insights/payment-gateway-integration/ ) 4/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
->setCustomerPhone('1987987987987')

// Credit Card Details

->setCardHolder('Emil Example')

->setCardNumber('4200000000000000')

->setExpirationMonth('01')

->setExpirationYear('2020')

->setCvv('123')

// Billing/Invoice Details

->setBillingFirstName('Travis')

->setBillingLastName('Pastrana')

->setBillingAddress1('Muster Str. 12')

->setBillingZipCode('10178')

->setBillingCity('Los Angeles')

->setBillingState('CA')

->setBillingCountry('US');

try {

// Send the request

$genesis->execute();

// Successfully completed the transaction - display the gateway unique id

echo $genesis->response()->getResponseObject()->unique_id;

// Log/handle API errors

// Example: Declined transaction, Invalid data, Invalid configuration

catch (\Genesis\Exceptions\ErrorAPI $api) {

echo $genesis->response()->getResponseObject()->technical_message;

// Log/handle invalid parameters

// Example: Empty (required) parameter

catch (\Genesis\Exceptions\ErrorParameter $parameter) {

error_log($parameter->getMessage());

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.
// Log/handle network (transport) errors

I AGREE CHANGE SETTINGS


// Example: SSL verification errors, Timeouts

https://www.emerchantpay.com/insights/payment-gateway-integration/ 5/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

catch (\Genesis\Exceptions\ErrorNetwork $network) {

error_log($network->getMessage());

?>

Notifications
When using an asynchronous workflow, you need to parse the incoming extension in order to ensure its authenticity and verify it
against the Genesis server.

Example:

<?php require 'vendor/autoload.php'; try {    $notification = new \Genesis\API\Notification($_POST);     //


Reconciliation is generally optional, but    // its a recommended practice to ensure    // that you have the
latest information    $notification->initReconciliation();     // Application Logic    // ...    // for
example, process the transaction status    // $status = $notification->getReconciliationObject()-
>status;     // Respond to Genesis    $notification->renderResponse();}catch (\Exception $e) {   
error_log($e->getMessage());} ?>

Endpoints
The current versions support two separate endpoints: E-ComProcessing and emerchantpay

You can set the Endpoint to E-ComProcessing, thus all the requests will go to E-ComProcessing’s Genesis instance:

\Genesis\Config::setEndpoint(\Genesis\API\Constants\Endpoints::ECOMPROCESSING);

You can set the Endpoint to emerchantpay, thus all the requests will go to emerchantpay’s Genesis instance:

\Genesis\Config::setEndpoint(\Genesis\API\Constants\Endpoints::EMERCHANTPAY);

Request types
You can use the following request types to initialise the Genesis client:

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.

I AGREE CHANGE SETTINGS

https://www.emerchantpay.com/insights/payment-gateway-integration/ 6/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

// Generic transaction operations

Financial\Capture

Financial\Refund

Financial\Cancel

// Alternative Payment Methods transactions

Financial\Alternatives\Earthport

Financial\Alternatives\P24

Financial\Alternatives\POLi

Financial\Alternatives\PPRO

Financial\Alternatives\Sofort

Financial\Alternatives\Trustly\Sale

Financial\Alternatives\Trustly\Withdrawal

Financial\Alternatives\PaypalExpress

// PayByVouchers transactions

Financial\PayByVouchers\oBeP

Financial\PayByVouchers\Sale

// Credit Cards transactions

Financial\Cards\Argencard

Financial\Cards\Aura

Financial\Cards\Authorize

Financial\Cards\Authorize3D

Financial\Cards\Bancontact

Financial\Cards\Cabal

Financial\Cards\Cencosud

Financial\Cards\Credit

Financial\Cards\Elo

Financial\Cards\Hipercard

Financial\Cards\Naranja

Financial\Cards\Nativa

Financial\Cards\Payout

Financial\Cards\Sale

Financial\Cards\Sale3D

Financial\Cards\TarjetaShopping

Financial\Cards\Recurring\InitRecurringSale

Financial\Cards\Recurring\InitRecurringSale3D

Financial\Cards\Recurring\RecurringSale

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
// Cash
information, check Payments
out our Cookietransactions

policy.
Financial\CashPayments\Baloto

Financial\CashPayments\Banamex

I AGREE CHANGE SETTINGS


Financial\CashPayments\BancoDeOccidente

https://www.emerchantpay.com/insights/payment-gateway-integration/ 7/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
Financial\CashPayments\Boleto

Financial\CashPayments\Carulla

Financial\CashPayments\Efecty

Financial\CashPayments\EmpreseDeEnergia

Financial\CashPayments\Oxxo

Financial\CashPayments\PagoFacil

Financial\CashPayments\Redpagos

Financial\CashPayments\SantanderCash

Financial\CashPayments\Surtimax

// Crypto transactions

Financial\Crypto\BitPay\Sale

Financial\Crypto\BitPay\Refund

Financial\Crypto\BitPay\Payout

// Gift Cards transactions

Financial\GiftCards\Intersolve

Financial\GiftCards\Fashioncheque

Financial\GiftCards\TCS

//Sepa Direct Debit transactions

Financial\SCT\Payout

Financial\SDD\Sale

Financial\SDD\Refund

Financial\SDD\Recurring\InitRecurringSale

Financial\SDD\Recurring\RecurringSale

//Online Banking Payments

Financial\OnlineBankingPayments\Alipay

Financial\OnlineBankingPayments\BancoDoBrasil

Financial\OnlineBankingPayments\Bancomer

Financial\OnlineBankingPayments\Bradesco

Financial\OnlineBankingPayments\Entercash

Financial\OnlineBankingPayments\Eps

Financial\OnlineBankingPayments\GiroPay

Financial\OnlineBankingPayments\Ideal

Financial\OnlineBankingPayments\iDebit\Payin
Financial\OnlineBankingPayments\iDebit\Payout

Financial\OnlineBankingPayments\InstaDebit\Payin

Financial\OnlineBankingPayments\InstaDebit\Payout

Financial\OnlineBankingPayments\InstantTransfer

Financial\OnlineBankingPayments\Itau

Financial\OnlineBankingPayments\Multibanco

Financial\OnlineBankingPayments\MyBank

Financial\OnlineBankingPayments\PaySec\Payin
Financial\OnlineBankingPayments\PaySec\Payout

Financial\OnlineBankingPayments\PayU

Financial\OnlineBankingPayments\Pse

Financial\OnlineBankingPayments\RapiPago

Financial\OnlineBankingPayments\SafetyPay

Financial\OnlineBankingPayments\Santander

Financial\OnlineBankingPayments\TrustPay

Financial\OnlineBankingPayments\WeChat

Financial\Preauthorization\IncrementalAuthorize

Financial\Preauthorization\PartialReversal

// Vouchers

Financial\Vouchers\AstropayCard

Financial\Vouchers\CashU

Financial\Vouchers\Neosurf

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
Financial\Vouchers\Paysafecard

information, check out our Cookie policy.

// Electronic
I AGREE Wallets
CHANGE transactions

SETTINGS
Financial\Wallets\eZeeWallet

Fi i l\W ll t \N t ll
https://www.emerchantpay.com/insights/payment-gateway-integration/ 8/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
Financial\Wallets\Neteller

Financial\Wallets\Qiwi

Financial\Wallets\WebMoney

Financial\Wallets\Zimpler

// Generic (Non-Financial) requests

NonFinancial\AccountVerification

NonFinancial\Blacklist

// Consumers API requests

NonFinancial\Consumers\Create

NonFinancial\Consumers\Retrieve

NonFinancial\Consumers\Update

NonFinancial\Consumers\Disable

NonFinancial\Consumers\Enable

// Chargeback information request

NonFinancial\Fraud\Chargeback\DateRange

NonFinancial\Fraud\Chargeback\Transaction

// SAFE/TC40 Report

NonFinancial\Fraud\Reports\DateRange

NonFinancial\Fraud\Reports\Transaction

// Retrieval request

NonFinancial\Fraud\Retrieval\DateRange

NonFinancial\Fraud\Retrieval\Transaction

// Fx requests

NonFinancial\Fx\GetTiers

NonFinancial\Fx\GetTier

NonFinancial\Fx\GetRates

NonFinancial\Fx\GetRate

NonFinancial\Fx\SearchRate

// KYC requests

NonFinancial\KYC\Call\Create

NonFinancial\KYC\Call\Update

NonFinancial\KYC\ConsumerRegistration\Create
NonFinancial\KYC\ConsumerRegistration\Update
NonFinancial\KYC\IdentityDocument\Download

NonFinancial\KYC\IdentityDocument\Upload

NonFinancial\KYC\Transaction\Create

NonFinancial\KYC\Transaction\Update

// Reconcile requests

NonFinancial\Reconcile\DateRange

NonFinancial\Reconcile\Transaction

// Get ABN iDEAL supported banks

NonFinancial\Retrieve\AbniDealBanks

// Web Payment Form (Checkout) requests

WPF\Create

WPF\Reconcile

When all this has been completed, you can then start testing >>

Payment gateway integration tutorial for Java


Installation and setup
We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.
Clone or download this GitHub repo
I AGREE CHANGE SETTINGS

git clone http://github.com/GenesisGateway/genesis_java genesis_javacd genesis_java


https://www.emerchantpay.com/insights/payment-gateway-integration/ 9/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
g p g yg j g j g j

mvn clean install


Add this to your pom.xml file:

<dependency>

<groupId>com.emerchantpay.gateway</groupId>

<artifactId>genesis-java</artifactId>

<version>1.7.0</version>

</dependency>

Example

import com.emerchantpay.gateway.GenesisClient;

import com.emerchantpay.gateway.api.TransactionResult;

import com.emerchantpay.gateway.api.constants.Endpoints;

import com.emerchantpay.gateway.api.constants.Environments;

import com.emerchantpay.gateway.api.requests.financial.card.AuthorizeRequest;

import com.emerchantpay.gateway.model.Transaction;

import com.emerchantpay.gateway.util.Configuration;

public class GenesisExample {

public static void main() {

// Create configuration

Configuration configuration = new Configuration(Environments.STAGING, Endpoints.EMERCHANTPAY);

configuration.setUsername("SET_YOUR_USERNAME");

configuration.setPassword("SET_YOUR_PASSWORD");

configuration.setToken("SET_YOUR_TOKEN");

String uniqueId = new StringUtils().generateUID();

AuthorizeRequest authorize = new AuthorizeRequest();

authorize.setTransactionId(uniqueId)

.setUsage("40208 concert tickets")

.setRemoteIp("245.253.2.12");

authorize.setGaming(true);

authorize.setCurrency("USD").setAmount(new BigDecimal("50.00"));

authorize.setCardHolder("Emil Example")

.setCardNumber("4200000000000000")

.setExpirationMonth("01")

.setExpirationYear("2020")

.setCvv("123");

authorize.setBillingFirstname("Travis")

.setBillingLastname("Pastrana")

.setBillingPrimaryAddress("Muster Str. 12")

.setBillingZipCode("10178")

.setBillingCity("Los Angeles")

.setBillingState("CA").setBillingCountry("US");

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.
GenesisClient client = new GenesisClient(configuration, authorize);

client.debugMode(true);

I AGREE CHANGE SETTINGS


client.execute();

https://www.emerchantpay.com/insights/payment-gateway-integration/ 10/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

// Parse Payment result

TransactionResult<? extends Transaction> result = client.getTransaction().getRequest();

System.out.println("Transaction Id: " + result.getTransaction().getTransactionId());

Notifications

import com.emerchantpay.gateway.NotificationGateway;

import com.emerchantpay.gateway.api.constants.Endpoints;

import com.emerchantpay.gateway.api.constants.Environments;

import com.emerchantpay.gateway.util.Configuration;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

public class NotificationExample {

public static void main() throws UnsupportedEncodingException, NoSuchAlgorithmException {

// Create configuration

Configuration configuration = new Configuration(Environments.STAGING, Endpoints.EMERCHANTPAY);

configuration.setUsername("SET_YOUR_USERNAME");

configuration.setPassword("SET_YOUR_PASSWORD");

configuration.setToken("SET_YOUR_TOKEN");

Map<String, String> map = new HashMap<String, String>();

map.put("transaction_id", "82803B4C-70CC-43BD-8B21-FD0395285B40");

map.put("unique_id", "fc6c3c8c0219730c7a099eaa540f70dc");

map.put("signature", "3070d7030806a3763fcae73923d9c2da0898dd19");

map.put("transaction_type", "sale3d");

map.put("terminal_token", configuration.getToken());

map.put("status", "approved");

map.put("amount", "500");

map.put("eci", "05");

map.put("avs_response_code", "5I");

map.put("avs_response_text", "Response+provided+by+issuer+processor%3B+
Address+information+not+verified");

NotificationGateway notification = new NotificationGateway(configuration, map);

// Execute Reconcile request

notification.initReconciliation();

// Get status of Reconcile response

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check // String
out our status = notification.getReconcilation().getStatus();

Cookie policy.

I AGREE //CHANGE
Generate the Gateway response

SETTINGS
notification.generateResponse();

https://www.emerchantpay.com/insights/payment-gateway-integration/ 11/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

// Get Gateway response

String response = notification.getResponse().toXML();

System.out.println(response);

// Get List with Response params

List<Map.Entry<String,Object>> responseParamsList = notification.getResponseParams();

for (Map.Entry<String,Object> param: responseParamsList) {

System.out.print(param.getKey() + "=" + param.getValue());

// Get unique id param from Response


String uniqueId = notification.getResponseUniqueId();

System.out.println(uniqueId);

Endpoints

The current version supports two endpoints: ECOMPROCESSING and EMERCHANTPAY

Request types
You can use the following request types to initialise the Genesis client:

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.

I AGREE CHANGE SETTINGS

https://www.emerchantpay.com/insights/payment-gateway-integration/ 12/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

// Generic transaction operations

api.requests.financial.CaptureRequest

api.requests.financial.RefundRequest

api.requests.financial.VoidRequest

// Alternative Payment Methods transactions

api.requests.financial.apm.CashURequest

api.requests.financial.apm.P24Request

api.requests.financial.apm.PaySafeCardRequest

api.requests.financial.apm.POLiRequest

api.requests.financial.apm.PProRequest

api.requests.financial.apm.SofortRequest

api.requests.financial.apm.TrustlySaleRequest

api.requests.financial.apm.TrustlyWithdrawalRequest

api.requests.financial.apm.PayPalExpressRequest

api.requests.financial.apm.EarthportRequest

// PayByVouchers transactions

api.requests.financial.pbv.PBVSaleRequest

api.requests.financial.pbv.PBVYeePayRequest

// Credit Cards transactions

api.requests.financial.card.AuthorizeRequest
api.requests.financial.card.Authorize3DRequest

api.requests.financial.card.CreditRequest

api.requests.financial.card.PayoutRequest

api.requests.financial.card.SaleRequest

api.requests.financial.card.Sale3DRequest

api.requests.financial.card.recurring.InitRecurringSaleRequest

api.requests.financial.card.recurring.InitRecurringSale3DRequest

api.requests.financial.card.recurring.RecurringSaleRequest

//Sepa Direct Debit transactions

api.requests.financial.sdd.SDDSaleRequest

api.requests.financial.sct.SCTPayoutRequest

api.requests.financial.sdd.SDDRefundRequest

api.requests.financial.sdd.SDDInitRecurringSaleRequest

api.requests.financial.sdd.SDDRecurringSaleRequest

//Online Banking Payments

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
api.requests.financial.apm.CitadelPayInRequest

information, check out our Cookie policy.


api.requests.financial.apm.CitadelPayOutRequest

api.requests.financial.oBeP.InstadebitPayInRequest

I AGREE CHANGE SETTINGS


api.requests.financial.oBeP.InstaDebitPayInRequest

https://www.emerchantpay.com/insights/payment-gateway-integration/ 13/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
api.requests.financial.oBeP.IDebitPayInRequest

api.requests.financial.oBeP.IDebitPayOutRequest

api.requests.financial.oBeP.AlipayRequest

api.requests.financial.oBeP.WechatRequest

api.requests.financial.oBeP.PaySecRequest

api.requests.financial.oBeP.PaySecPayoutRequest

api.requests.financial.oBeP.RPNRequest

api.requests.financial.oBeP.RPNPayoutRequest

// Electronic Wallets transactions

api.requests.financial.wallets.eZeeWalletRequest

api.requests.financial.wallets.NetellerRequest

api.requests.financial.wallets.WebMoneyRequest

// Generic (Non-Financial) requests

api.requests.nonfinancial.AccountVerificationRequest

api.requests.nonfinancial.BlacklistRequest

// Chargeback information request

api.requests.nonfinancial.fraud.ChargebackByDateRequest

api.requests.nonfinancial.fraud.ChargebackRequest

// SAFE/TC40 Report

api.requests.nonfinancial.fraud.ReportsByDateRequest

api.requests.nonfinancial.fraud.ReportsRequest

// Retrieval request

api.requests.nonfinancial.fraud.RetrievalByDateRequest

api.requests.nonfinancial.fraud.RetrievalRequest

// Reconcile requests

api.requests.nonfinancial.reconcile.ReconcileByDate

api.requests.nonfinancial.reconcile.ReconcileRequest

// Get ABN iDEAL supported banks

api.requests.nonfinancial.retrieve.AbnIDealBanksRetrieveRequest

// Web Payment Form (Checkout) requests

api.requests.wpf.WPFCreateRequest

api.requests.wpf.WPFReconcileRequest

// Gift Card requests

api.requests.financial.giftcards.FashionchequeRequest

api.requests.financial.giftcards.IntersolveRequest

api.requests.financial.giftcards.TCSRequest

More information about each one of the request types can be found in the Genesis API Documentation and the Wiki.

When all this has been completed, you can then start testing >>

Payment gateway integration tutorial for Java Android SDK


Installation and setup
Clone or download this repo:

git clone http://github.com/GenesisGateway/android_sdk GenesisAndroidcd GenesisAndroid

Gradle
We areThen,
using cookies
add theto give you the bestinexperience
dependency on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
your build.gradle:
information, check out our Cookie policy.

dependencies
I AGREE CHANGE SETTINGS

https://www.emerchantpay.com/insights/payment-gateway-integration/ 14/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

dependencies {

implementation 'com.emerchantpay.gateway:genesis-android:1.2.1'

Basic usage
AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="YOUR_PACKAGE">

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27" />

<application

android:allowBackup="true"

android:icon="@mipmap/ic_launcher"

android:label="@string/app_name"

android:roundIcon="@mipmap/ic_launcher_round"

android:supportsRtl="true"

android:theme="@style/AppTheme">

<activity android:name=".MainActivity">

<intent-filter>

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>

</activity>

<activity android:name="com.emerchantpay.gateway.genesisandroid.api.ui.GenesisWebViewActivity"/>

</application>

</manifest>

MainActivity.java:

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.

I AGREE CHANGE SETTINGS

https://www.emerchantpay.com/insights/payment-gateway-integration/ 15/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

import android.R

import android.app.Activity

import android.os.Bundle

import android.view.View

import com.emerchantpay.gateway.androidgenesissample.R

import com.emerchantpay.gateway.genesisandroid.api.ui.AlertDialogHandler

import com.emerchantpay.gateway.genesisandroid.api.constants.Endpoints

import com.emerchantpay.gateway.genesisandroid.api.constants.Environments

import com.emerchantpay.gateway.genesisandroid.api.constants.ErrorMessages

import com.emerchantpay.gateway.genesisandroid.api.constants.Locales

import com.emerchantpay.gateway.genesisandroid.api.internal.Genesis

import com.emerchantpay.gateway.genesisandroid.api.internal.request.PaymentRequest

import com.emerchantpay.gateway.genesisandroid.api.internal.request.TransactionTypesRequest
import com.emerchantpay.gateway.genesisandroid.api.internal.response.Response

import com.emerchantpay.gateway.genesisandroid.api.models.Country

import com.emerchantpay.gateway.genesisandroid.api.models.Currency

import com.emerchantpay.gateway.genesisandroid.api.models.GenesisError

import com.emerchantpay.gateway.genesisandroid.api.models.PaymentAddress

import com.emerchantpay.gateway.genesisandroid.api.models.WPFTransactionTypes

import com.emerchantpay.gateway.genesisandroid.api.util.Configuration

import java.math.BigDecimal

import java.util.UUID

class MainActivity : Activity() {

override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

setContentView(R.layout.activity_main)

@Throws(IllegalAccessException::class)

fun loadPaymentPage(view: View) {

// Generate unique Id

val uniqueId = UUID.randomUUID().toString()

// Create configuration

val configuration = Configuration("SET_YOUR_USERNAME",

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
"SET_YOUR_PASSWORD",

information, check out our Cookie policy.


Environments.STAGING, Endpoints.EMERCHANTPAY, Locales.EN)

I AGREE CHANGE SETTINGS


// Enable Debug mode

( )
https://www.emerchantpay.com/insights/payment-gateway-integration/ 16/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
configuration.setDebugMode(true)

// Alert dialog

var dialogHandler: AlertDialogHandler

// Create Billing PaymentAddress

val billingAddress = PaymentAddress("John", "Doe",

"Fifth avenue 1", "Fifth avenue 1", "10000", "New York",

"Washington", Country.UnitedStates)

// Create Transaction types

val transactionTypes = TransactionTypesRequest()

transactionTypes.addTransaction(WPFTransactionTypes.sale)

// Init WPF API request

val paymentRequest = PaymentRequest(this, uniqueId,

BigDecimal("2.00"), Currency.USD,

"[email protected]", "+555555555", billingAddress,

"https://example.com", transactionTypes)

val genesis = Genesis(this, configuration, paymentRequest)

// Genesis Error handler

var error: GenesisError?// Get Error Handler

when {

genesis.isConnected(this)!! -> {

dialogHandler = AlertDialogHandler(this, "Error",

ErrorMessages.CONNECTION_ERROR)

dialogHandler.show()

when {

genesis.isConnected(this)!! && genesis.isValidData!! -> {

//Execute WPF API request

genesis.push()

// Get response

val response = genesis.response

// Check if response isSuccess

when {

response!!.isSuccess!! -> {

// Get Error Handler

error = response!!.error

dialogHandler = AlertDialogHandler(this, "Failure",

"Code: " + error!!.code + "\nMessage: "

+ error!!.message)

dialogHandler.show()

when {

genesis.isValidData!! -> {

// Get Error Handler

error = genesis.error

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
val message = error!!.message

information, check out our Cookie policy.


val technicalMessage: String?

I AGREE CHANGE SETTINGS


when {

!! t h i lM ! ll && !
https://www.emerchantpay.com/insights/payment-gateway-integration/
!! t h i lM !! i E t () t h i lM 17/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
error!!.technicalMessage != null && !error!!.technicalMessage!!.isEmpty() -> technicalMessage =
error!!.technicalMessage

else -> technicalMessage = ""

dialogHandler = AlertDialogHandler(this, "Invalid",

"$technicalMessage $message")

dialogHandler.show()

Additional usage
You will have to set usage, description and lifetime:

paymentRequest.setUsage("TICKETS")

paymentRequest.setDescription("Description")
paymentRequest.setLifetime(60)

Set shipping address

val shippingAddress = PaymentAddress("John", "Doe",

"Fifth avenue 1", "Fifth avenue 1", "10000", "New York",

"Washington", Country.UnitedStates)

paymentRequest.setShippingAddress(shippingAddress)

Set risk parameters

// Risk params

val riskParams = RiskParams("1002547", "1DA53551-5C60-498C-9C18-8456BDBA74A9",

"987-65-4320", "12-34-56-78-9A-BC", "123456",

"[email protected]", "+49301234567", "245.253.2.12",

"10000000000", "1234", "100000000", "John",

"Doe", "US", "test", "245.25 3.2.12",

"test", "test123456", "Bin name",

"+49301234567")

paymentRequest.setRiskParams(riskParams)

Once all of these stages have been completed, you can then test the gateway.

Payment Gateway integration tutorial for Node.js


Installation
npm install genesis.js

Getting started
In order to process transactions via Genesis, you'll have to acquire the necessary credentials in order to connect to the gateway.

Configuration
We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.
You can override the path to the directory holding your configuration files (by default it’s config in the root directory of the module)
I AGREE CHANGEvariable NODE_CONFIG_DIR.
via environmental SETTINGS The first file to parse configuration from, is <your-config-dir>/default.json and based
on the environment variable (NODE ENV), you can specify your custom file; for example <your-config-
https://www.emerchantpay.com/insights/payment-gateway-integration/ 18/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
o t e e o e t a ab e ( O _ ), you ca spec y you custo e; o e a p e  you co g
dir>/<NODE_ENV_NAME>.json. It’s good practice to prevent web or direct access to your config directory to protect the files inside.

Sale transaction
JavaScript

var crypto, failure, genesis, success, transaction;

genesis = require('./lib/genesis.js');

crypto = require('crypto');

transaction = new genesis.transaction();

failure = function(reason) {

return console.log(reason);

};

success = function(data) {

return console.log(data);

};

transaction.sale({

transaction_id: crypto.randomBytes(16).toString('hex'),

usage: 'Demo Payment Transaction',

description: 'This is my first payment',


remote_ip: '127.0.0.1',

amount: '100',

currency: 'USD',

card_holder: 'John Doe',

card_number: '4200000000000000',

cvv: '000',

expiration_month: 12,

expiration_year: 2020,

customer_email: '[email protected]',

customer_phone: '0123456789',

billing_address: {

first_name: 'John',

last_name: 'Doe',

address1: '123 Str.',

zip_code: '10000',

city: 'New York',

country: 'US'

})

.send()

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
.then(success)

information, check out our Cookie policy.


.catch(failure);

CoffeeScript

I AGREE CHANGE SETTINGS


genesis = require './lib/genesis.js'

https://www.emerchantpay.com/insights/payment-gateway-integration/ 19/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
crypto = require 'crypto'

transaction = new genesis.transaction();

failure = (reason) ->

console.log reason

success = (data) ->

console.log data

transaction.sale({

transaction_id : crypto.randomBytes(16).toString('hex')

usage : 'Demo Payment Transaction'

description : 'This is my first payment'

remote_ip : '127.0.0.1'

amount : '100'

currency : 'USD'

card_holder : 'John Doe'

card_number : '4200000000000000'

cvv : '000'

expiration_month : 12

expiration_year : 2020

customer_email : '[email protected]'

customer_phone : '0123456789'

billing_address :

first_name: 'John'

last_name : 'Doe'

address1 : '123 Str.'

zip_code : '10000'

city : 'New York'

country : 'US'

})

.send()

.then(success)

.catch(failure)

The example above is going to create a Sale (Authorise w/ immediate Capture) transaction for the amount of $100.

Web Payment Form transaction


JavaScript

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.

I AGREE CHANGE SETTINGS

https://www.emerchantpay.com/insights/payment-gateway-integration/ 20/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

var crypto, failure, genesis, success, transaction;

genesis = require('./lib/genesis.js');

crypto = require('crypto');

transaction = new genesis.transaction();

failure = function(reason) {

return console.log(reason);

};

success = function(data) {

return console.log(data);

};

transaction.wpf_create({

locale: 'de',

transaction_id: crypto.randomBytes(16).toString('hex'),

usage: 'Demo WPF Transaction',

description: 'This is my first WPF transaction',

remote_ip: '127.0.0.1',

amount: '100',

currency: 'USD',

customer_email: '[email protected]',

customer_phone: '0123456789',

notification_url: 'http://my.host.name.tld:1234/notifier',

return_success_url: 'http://my.host.name.tld/success',

return_failure_url: 'http://my.host.name.tld/failure',

return_cancel_url: 'http://my.host.name.tld/cancel',

billing_address: {

first_name: 'John',

last_name: 'Doe',

address1: '123 Str.',

zip_code: '10000',

city: 'New York',

country: 'US'

},

transaction_types: ['authorize3d', 'sale']

})

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
.send()

information, check out our Cookie policy.


.then(success)

.catch(failure);

I AGREE CHANGE SETTINGS

CoffeeScript
https://www.emerchantpay.com/insights/payment-gateway-integration/ 21/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
CoffeeScript

genesis = require './lib/genesis.js'

crypto = require 'crypto'

transaction = new genesis.transaction();

failure = (error, body) ->

console.log error, body

success = (response, body) ->

console.log body

transaction.wpf_create({

locale : 'de'

transaction_id : crypto.randomBytes(16).toString('hex')

usage : 'Demo WPF Transaction'

description : 'This is my first WPF transaction'

remote_ip : '127.0.0.1'

amount : '100'

currency : 'USD'

customer_email : '[email protected]'

customer_phone : '0123456789'

notification_url : 'http://my.host.name.tld:1234/notifier'

return_success_url: 'http://my.host.name.tld/success'

return_failure_url: 'http://my.host.name.tld/failure'

return_cancel_url : 'http://my.host.name.tld/cancel'

billing_address :

first_name: 'John'

last_name : 'Doe'

address1 : '123 Str.'

zip_code : '10000'

city : 'New York'

country : 'US'

transaction_types: [

'authorize3d'

'sale'

})

.send()

.then(success)

.catch(failure)

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.
The example above is going to create a new WPF instance with German (de) locale and allowed transaction types
- authorize3d (Authorize
I AGREE w/ 3D-Secure asynchronously) and sale for the amount of $100.
CHANGE SETTINGS

N tifi ti li t
https://www.emerchantpay.com/insights/payment-gateway-integration/ 22/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

Notification listener
JavaScript

var success, failure, genesis, notification, notification_url;

genesis = require('./lib/genesis.js');

notification = new genesis.notification();

success = function(result) {

return console.log(result);

};

failure = function(error) {

return console.log(error);

};

notification.listen(success, failure);

notification_url = notification.getUrl();

CoffeeScript

genesis = require './lib/genesis.js'

notification = new genesis.notification()

success = (result) =>

console.log result

failure = (error) =>

console.log error

notification.listen success, failure

notification_url = notification.getUrl()

The example above would create a notification listener on my.host.name.tld:1234/notifier which you can use as notification handler
for async transactions. If a notification is received and it’s successfully verified against our backend, the callback will be called with
details of the transaction you're being notified for.

Handling notifications with a separate web server


If you have already setup a web server and do not want to start another, or if you want to use a different one like Express for
example, you can accomplish this by calling handle method in your web server route.

Request and response objects should be enhanced versions of Node’s own request and response objects and support all built-in
fields and methods.

JavaScript

var genesis, notification;

genesis = require('./lib/genesis.js');

notification = new genesis.notification();

var bodyParser = require('body-parser');

var urlencodedParser = bodyParser.urlencoded({ extended: true })

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
router.post('/listen', urlencodedParser, function (request, response) {

information, check out our Cookie policy.


notification.handle(request, response)

.then(console.log)

I AGREE CHANGE SETTINGS


.catch(console.log);

});
https://www.emerchantpay.com/insights/payment-gateway-integration/ 23/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
});

CoffeeScript

genesis = require './lib/genesis.js'

notification = new genesis.notification()

bodyParser = require 'body-parser'

urlencodedParser = bodyParser.urlencoded({ extended: true })

router.post('/listen', urlencodedParser, (request, response) ->

notification.handle(request, response)

.then console.log

.catch console.log

Transaction types

account_verification

avs

authorize

authorize3d

blacklist

capture

chargeback

chargeback_by_date

credit

fraud_report

fraud_report_by_date

init_recurring

init_recurring_sale3d

reconcile

reconcile_by_date

recurring_sale

refund

retrieval

retrieval_by_date

payout

sale

sale3d

void

wpf_create

wpf_reconcile

p24

Transaction parameters
In order to get a full list of required and optional parameters, please consult our API documentation.

After all these steps have been completed you may now proceed to testing.

The emerchantpay payment gateway also supports .NET and Swift (iOS client library) integrations. You can find the full
documentation here:

.NET documentation
Swift documentation

Payment gateway integration with popular CMS


We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.

We have
I AGREE developed easy to install and configure modules for all of the most popular content managements systems, including
CHANGE SETTINGS
Magento version 1 and 2, Opencart, osCommerce, PrestaShop, Shopify, WooCommerce, X-Cart and Zen Cart.
https://www.emerchantpay.com/insights/payment-gateway-integration/ 24/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

We will explain the integration process for Wordpress, Opencart and Prestashop. If you are using any of the other CMS mentioned
above, you can find the full instructions and documentation in GitHub.

Magento 1.x CE gateway integration instructions >>


Magento 2.x CE gateway integration instructions >>
osCommerce gateway integration instructions >>
Shopify gateway integration instructions >>
X-Cart gateway integration instructions >>
Zen Cart gateway integration instructions >>

Payment gateway integration with WordPress (WooCommerce) tutorial


Requirements
WordPress 4.x or 5.x (tested up to 5.2.2)
WooCommerce 2.x or 3.x (tested up to 3.7.0)
GenesisPHP v1.17.0- (integrated in module)
PCI-certified server in order to use emerchantpay Direct
WooCommerce Subscription Extensionx (tested up to 2.2.13) in order to use subscriptions.

Installation
Log in to your WordPress admin panel with your administrator account privileges
Navigate to Plugins -> add new
Install through the Marketplace by typing emerchantpay in the search
Select the downloaded .zip file
Activate the newly installed WooCommerce emerchantpay Payment Gateway Client plugin
Navigate to WooCommerce -> settings -> checkout
Select your preferred payment method emerchantpay Checkout or emerchantpay Direct
Check enable, set the correct credentials and save changes.

Enable WooCommerce Secure Checkout


The below steps should be followed if you wish to use the emerchantpay Direct method

Ensure you have installed and configured a SSL Certificate on your PCI-DSS certified server
Log in to your WordPress admin panel with administrator privileges
Navigate to WooCommerce - > settings -> checkout
Under Checkout Process check force secure checkout.

If you are using tokenisation for your Web Payment Form, please make sure Guest Checkout is disabled.

Subscriptions
In order to process subscriptions, the WooCommerce Subscription Extension needs to be installed, which will add subscription
support to the WooCommerce plugin.

Add subscription product


Log in to the WordPress admin panel
Go to Products 
Add product or choose a product to edit
Choose simple subscription from the Product Data dropdown menu
Check virtual or downloadable if needed
In tab General you can define your subscription details
Subscription price - will be used for the Recurring Saletransactions
Subscription length
We are using cookiesSign-up
to give youfee - willexperience
the best be used ononce for By
our site. the Init Recurring transaction
continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
Free
information, check out trial - policy.
our Cookie define the period in which the consumer will not pay the subscription price
In tab Inventory individually check sold if you don't want the subscription's quantity to be increased in the shopping cart.
I AGREE CHANGE SETTINGS

Manage subscriptions
https://www.emerchantpay.com/insights/payment-gateway-integration/ 25/31
a age subsc pt o s
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

Navigate to WooCommerce -> Subscriptions and choose your subscription


You can suspend or cancel a subscription by using the links next to the subscription's status label or manually change its
status
When you enter into a subscription, you can preview also the related orders and modify the billing schedule
If you wish to perform a manual re-billing, choose process renewal from the Subscriptions Actions dropdown list on the right
and click the button next to the dropdown.

Refund a subscription
You are only allowed to refund the sign-up fee for a subscription

Navigate to WooCommerce -> Subscriptions and choose your subscription


Scroll down to the related orders and click on the parent order
Scroll down to the order items and click the refund button
Define the refund amount. Bear in mind that the refundable amount may be lower than the total order amount, because
the parent order might be related to Init Recurring& Recurring Sale transactions. You are only allowed to refund the amount
of the Init Recurring transaction.

After a refund is processed, the related subscription should be marked as cancelled and a noteshould be added to


the subscription.

Processing recurring transactions


Recurring payments are scheduled and executed by the WooCommerce Subscription Plugin and an information email should be
sent.

Configuring WordPress cron


If your WordPress site is on a hosted environment, login to your C-Panel and add a cron job for executing the WP cron.

cd /path/to/wordpress/root; php -q wp-cron.php

If your site is hosted on your server, connect to the machine using SSH and type the following command into the terminal to edit
your cron jobs. Do not forget to replace www-data with your WebServer User.

sudo crontab -u www-data -e

and add the following line to execute the WordPress Cron once per 10 Minutes

*/10 * * * * cd /path/to/wordpress/root && php -q wp-cron.php

Payment gateway integration with OpenCart tutorial


To integrate our payment gateway in OpenCart, you need to first download our OpenCart module. It can be downloaded from here.

OpenCart 2.0.X - 3.0.2.X (due to architectural changes, this module is incompatible with OpenCart 1.X)
GenesisPHP v1.4 - (integrated in module)
PCI-certified server in order to use emerchantpay Direct

Installation (via Extension Installer - up to 3.x)


1. Download the emerchantpay payment gateway, extract the contents of the folder (excluding README.md) into an empty
folder created on your local computer.

For version 2.0.x exclude folder admin/controller/extension/payment

2. Create a compressed zip file of the folder uploaded with the name emerchantpay.ocmod.zip


3. Log in to the OpenCart admin panel
4. Navigate to Extensions -> Extension Installer, click upload and choose the zip file emerchantpay.ocmod.zip to install
We are using the emerchantpay payment
cookies to give you the best gateway.
experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information,
5.check outreceive
If you our Cookie
anpolicy.
error message FTP needs to be enabled in the settings, go to System -> Settings -> Your Store -> Edit ->
FTP and configure your FTP account settings and repeat step 4.
I AGREE CHANGE SETTINGS
6. Navigate to Extensions -> Payments and click install on emerchantpay Direct and/or emerchantpay Checkout
7 S t th l i d ti l (
https://www.emerchantpay.com/insights/payment-gateway-integration/
d t k ) d dj t th fi ti t d 26/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
7. Set the login credentials (username, password, token) and adjust the configuration to your needs.

Installation (manual)
1. Upload the contents of the folder (excluding README.md) to the <root> folder of your OpenCart installation

For version 2.0.x you will have to delete folder admin\controller\extension\payment

2. Log in to the OpenCart admin panel


3. Navigate to Extensions -> Payments and click install on emerchantpay Direct and/or emerchantpay Checkout
4. Set the login credentials (username, password, token) and adjust the configuration to your needs.

[H4] Enable OpenCart SSL

These steps should be followed if you wish to use the emerchantpay Direct method.

Ensure you have installed a valid SSL Certificate on your PCI-DSS certified web server and you have configured your virtual
host properly
Log in to your OpenCart admin panel
Navigate to Settings -> Your Store -> Server

Set use SSL to yes in Security tab and save your changes


Set the HTTPS_SERVER and HTTPS_CATALOG settings in your admin/config.php to use https protocol
Set the HTTPS_SERVER setting in your config.php to use https protocol
Set the site_ssl setting to true in your system/config/default.php file
It is recommended to add a rewrite rule from http to https or to add a permanent redirectto https in your virtual host.

If you have trouble with your credentials or terminal configuration, get in touch with our support team.

Payment gateway integration with PrestaShop tutorial


Requirements
PrestaShop 1.6.x - 1.7.x (tested up to 1.7.4)
GenesisPHP v1.17.0 (integrated in module)
PCI-certified server in order to use emerchantpay Direct

Installation (manual)
Upload the contents of folder (excluding README.md) to the <root> folder of your PrestaShop installation
Login into your PrestaShop admin panel
Navigate to Modules -> Payment
Locate emerchantpay payment gateway in the list and click install
Tweak the settings according to your preference and click save when ready
You can find the new payment methods in the checkout section of your store front
Clear the cache via Advanced Parameters -> Performance -> clear cache

Installation (upload via admin panel)


Recommended if you do not have a FTP account to upload the plugin code directly to your PrestaShop

Download the source code of the plugin as zip file


Decompress the zip archive and create a new archive of the folder emerchantpay, which is inside the modules folder
Log in into your PrestaShop admin panel
Navigate to Modules and Services in the main menu
Click upload a module or add a new module (depending on the version of PrestaShop) and choose the manually
created zip file
If you are using PrestaShop 1.7.x, then the plugin will be automatically installed. If you are using an older version of
PrestaShop, find our emerchantpay payment gateway module below and install it
After the module is installed, you can configure the newly installed emerchantpay payment gateway according to your needs
We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
and out
information, check save any changes
our Cookie policy. when ready
You can find the new payment methods in the checkout section in your store front
I AGREE CHANGE
Clear the SETTINGS
cache via Advanced Parameters -> Performance -> clear cache

https://www.emerchantpay.com/insights/payment-gateway-integration/ 27/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

If you have payment restrictions in place, you'll have to add the newly installed payment method to
the currencies / countries / groups you wish to appear on.

Enable PrestaShop SSL


These steps should be followed if you wish to use the emerchantpay Direct method.

Ensure you have installed a valid SSL Certificate on your PCI-DSS certified web server and you have configured your virtual
host properly
Log in to your PrestaShop admin panel
Navigate to Shop Parameters -> General
Click the link titled ‘please click here to check if your shop supports HTTPS’ near to the enable SSL option
Set enable SSL to yes
Click save
Set enable SSL on all pages to yes
Click save
It is recommended to add a rewrite rule from http to https or to add a permanent redirect to https in your virtual host.

Testing
To test your newly integrated payment gateway, log in to the gateway admin and create a terminal.

The URL for testing is: https://staging.merchant.emerchantpay.net/

The API base URL for test processing is: https://staging.gate.emerchantpay.net/process/TERMINAL_TOKEN

The API base URL for testing single transaction reconciling is: https://staging.gate.emerchantpay.net/reconcile/TERMINAL_TOKEN

The API base URL for test date range reconciling is: https://staging.gate.emerchantpay.net/reconcile/by_date/TERMINAL_TOKEN

The following credit card numbers can be used to test the gateway:

Card number card brand transaction result

4200000000000000 Visa successful transaction

4111111111111111 Visa transaction declined

5555555555554444 Mastercard successful transaction

5105105105105100 Mastercard transaction declined

For 3DSecure testing the following credit card numbers can be used:

Card number card brand transaction result

4711100000000000 Visa 3DSecure enrolled

3DSecure enrolled failing


4012001037461114 Visa
authentication

3DSecure unavailable -
4012001036853337 Visa
Card Not Participating

Error in 3DSecure Network


4012001037484447 Visa in first step of 3DS
We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
authentication process
information, check out our Cookie policy.

I AGREE CHANGE SETTINGS Error in 3DSecure Network


in second (asynchronous)
4012001036273338 Visa
https://www.emerchantpay.com/insights/payment-gateway-integration/ 28/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
4012001036273338 Visa
step of 3DS authentication
process

5420923878724339 Mastercard 3DSecure enrolled

3DSecure enrolled failing


5185540810000019 Mastercard
authentication

3DSecure unavailable -
5111010030175156 Mastercard
Card Not Participating

Error in 3DSecure Network


5200828282828210 Mastercard in first step of 3DS
authentication process

Error in 3DSecure Network


in second (asynchronous)
5204230080000017 Mastercard
step of 3DS authentication
process

In test mode, successful transaction XML responses will include the following error message: ”TESTMODE: No real money will be
transferred!”

Conclusion
At emerchantpay, we strive to make the onboarding process as seamless as possible for our merchants, with 14 working days as
our optimal timeframe. Whilst we handle everything on our side, we only require patience and that the necessary information be
provided by merchants. Integrating with the emerchantpay payment gateway is straightforward if you follow our simple
instructions. Our support team are always on hand to offer assistance if you encounter any difficulties.

If you want to hear more about what emerchantpay has to offer get in touch today to chat to one of our specialists.

Related articles

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
Everything you need to know about
information, check out our Cookie policy. Error code 2000: What does "Do Not
payment
I AGREE
tokenisation
CHANGE SETTINGS
Honour" really mean?
Great for consumers a game-changer for merchants We ‘Do Not Honour’ – also known as error code 2000 and 05 –
https://www.emerchantpay.com/insights/payment-gateway-integration/ 29/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay
Great for consumers, a game changer for merchants. We Do Not Honour also known as error code 2000 and 05
all encounter tokenisation whenever we make a purchase is by far the most common of all the error codes that come
without having to re-enter all [...] up when a [...]

By  Daniel Shale By  Daniel Shale


14 May 2021 27 April 2021

Virtually unstoppable: the growth of


online learning and digital payments
Many schools closed their physical premises during the
pandemic, meaning they had to go online to ensure their
students were still getting [...]

By  Shannon Lynn
12 February 2021

Sign up for the emerchantpay newsletter


Email address*

Yes, send me the emerchantpay newsletter!*

I have read and understood the Privacy Policy and agree to the use of my personal data accordingly. By clicking SUBSCRIBE I consent to emerchantpay storing and processing my personal
data required to contact me. I understand I may unsubscribe from these communications at any time.

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.
SUBSCRIBE
I AGREE CHANGE SETTINGS

https://www.emerchantpay.com/insights/payment-gateway-integration/ 30/31
11/3/21, 10:22 PM Payment Gateway Integration Tutorial for Developers | emerchantpay

Privacy Policy | Cookies | Terms of Use | Security of Client Funds | Modern Slavery and Human Trafficking Statement

For the US only, emerchantpay corporation is a Registered MSP/ISO of Elavon, Inc. Georgia [a wholly owned subsidiary of U.S. Bancorp, Minneapolis, MN]

TM
Copyright ©2021, emerchantpay Ltd.

We are using cookies to give you the best experience on our site. By continuing to use our website without changing the settings, you are agreeing to our use of cookies. For more
information, check out our Cookie policy.

I AGREE CHANGE SETTINGS

https://www.emerchantpay.com/insights/payment-gateway-integration/ 31/31

You might also like