50% found this document useful (2 votes)
4K views30 pages

Easypaisa Merchant Integration Guide

This document provides guidance on integrating with Easypaisa's payment processing system. It describes: 1. How to activate a sandbox test account for integration testing. 2. The types of custom code integration available - redirection via post method for credit card transactions and REST API for mobile and over-the-counter transactions. 3. Details on the post method integration process for credit card transactions, including required parameters, sample codes, and encryption.

Uploaded by

SaifUllah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
50% found this document useful (2 votes)
4K views30 pages

Easypaisa Merchant Integration Guide

This document provides guidance on integrating with Easypaisa's payment processing system. It describes: 1. How to activate a sandbox test account for integration testing. 2. The types of custom code integration available - redirection via post method for credit card transactions and REST API for mobile and over-the-counter transactions. 3. Details on the post method integration process for credit card transactions, including required parameters, sample codes, and encryption.

Uploaded by

SaifUllah
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • How to activate your sandbox test account
  • Post Method Integration for Credit Card Transactions
  • Encryption Algorithm
  • REST APIs
  • Hash Encryption Sample Code
  • Instant Payment Notification
  • Testing Credentials for Sandbox
  • Live Account Activation
  • Hosted Checkout Integration
  • Pre-requisites

Easypaisa

Integration Guide

V.4.1

1|P a g e
Table of Contents
1. How to activate your sandbox test account: ................................................................................................................................. 3
2. Types of custom code Integration: ................................................................................................................................................ 3
3. Post Method Integration for Credit Card Transactions ................................................................................................................. 4
3.1 Post Method Sample Codes ........................................................................................................................................................ 5
3.2 Encryption Algorithm to get value of “merchantHashedReq” Parameter: ................................................................................. 6
3.3 Hash Encryption Sample Code:.................................................................................................................................................... 7
4. REST APIs ....................................................................................................................................................................................... 7
4.1 Purpose ........................................................................................................................................................................................ 7
4.2 Initiate OTC Transaction .............................................................................................................................................................. 7
4.3 Initiate MA Transaction ............................................................................................................................................................. 10
4.4 Inquire Transaction Status ......................................................................................................................................................... 13
4.5 Possible Reasons of API Response: ................................................................................................................................... 17
4.6 Optional Parameters ................................................................................................................................................................. 17
5. Instant Payment Notification: ..................................................................................................................................................... 17
5.1 What you need to do: ................................................................................................................................................................ 17
6. Testing Credentials for Sandbox (Test Account) .......................................................................................................................... 19
7. How to Go Live with your Easypaisa Account: ............................................................................................................................ 19
7.1 Live Account Activation ............................................................................................................................................................. 20
8. Hosted Checkout Integration ...................................................................................................................................................... 21
8.1 Hosted Fields: ............................................................................................................................................................................ 21
8.2 Checkout Form: ......................................................................................................................................................................... 21
8.3 Hash Parameter Generation ...................................................................................................................................................... 21
8.4 Encrypt Card Holder Information .............................................................................................................................................. 22
8.5 Hosted Checkout User Journey ................................................................................................................................................. 24
8.6 How to integrate ....................................................................................................................................................................... 27
8.7 Pre-requisites ............................................................................................................................................................................ 29

2|P a g e
1. How to activate your sandbox test account:

Your Sandbox (testing) account will be created by your designated Telenor POC. You will receive an email from
[Link]@[Link] on your provided email ID containing the link to your Sandbox account activation
along with the one time password sent on your registered number that you shared for sandbox creation.

Steps:

  Click the activation link in the email

  Enter your username. Your Username will be the email address provided by you for sandbox
 Enter OTP (one time password). Sent to you on your number

 Set a new password
You’re good to go!

Once you have successfully logged in to your Testing account. You will need two things in order to
start your integration.

1-Store ID: To find your store ID, login to the OPS Portal and click on the profile button on top right

2-Hashkey (Used only in Post Method for Credit Card Transactions): To generate your Hashkey. Go to Account
Settings>Generate Hashkey

2. Types of custom code Integration:

REDIRECTION REST API

REST based API only for


Post Method Integration
only for Credit Card Mobile Account and Over the
Transactions Counter Transactions

3|P a g e
3. Post Method Integration for Credit Card Transactions

Post method is a seamless 2 step process

STEP 1: The merchant needs to POST below parameters in a form to Easypaisa on the f o l l o w i n g STAGING URL:

URL: [Link]

Parameters Below:

Parameter O/M Name Explanation Possible Values


Amount M amount Total amount of the transaction in Numeric, kindly set the
amount to one decimal
PKR
point e.g. 10.0
Store Id M storeId Id of the store as provided by the Numeric

Post back URL M postBackURL The first post back URL for Character. This should be a
Confirmation public URL
Order M orderRefNum Merchant Generated order Character
Reference reference number
Number
Merchant M merchantHashedReq Hash value. Explained in detail in Character
Hashed section 3.3
Payment M paymentMethod Merchant will redirect their customers CC_PAYMENT_METHOD
Method to Easypaisa secure checkout for CC
Transactions
Expiry O expiryDate Merchant provided expiry date for the YYYYMMDD HHMMSS
Date particular transaction

Auto O autoRedirect If merchant wants to redirect to final 0/1


Redirect post back URL and the end of
Transaction
Email O emailAddr If the merchant wants to pass the Example value
Address customer’s entered email address it Test@[Link]
would be pre populated on Easypaisa
Mobile O mobileNum If the merchant wants to pass the Example Value
Number customer’s entered mobile number it
would be pre populated on Easypaisa 03321234567
checkout screen.

4|P a g e
Bank O bankIdentifier If the merchant wants to pass the 6 digit alphanumeric value
Identifier customer’s selected Bank
(Identification Number) in order to

2. After completing the form in Step 1 the customer will be pressing the Proceed Button and lands
back on the merchant website on the same URL given in postbackURL variable in the first step.
This will be a confirmation screen on merchant’s website to perform a handshake between
Easypaisa and merchant’s website. Then Easypaisa sends back a parameter named auth_token to
the postbackURL which is sent as a GET parameter. Now the merchant needs to post back below
two parameters again to the following URL:
URL: [Link]

Parameters:

auth_token

po stBackURL

After this redirection the Easypaisa authenticates the auth_token sent by merchant with t h e one it has
in the previous step, and upon successful authentication it will make customer land on the successful
checkout screen sending back following three variables to the second postBackURL:
status

desc

orderRefNumber

Parameter O/M Name Explanation Possible Values


Status of the transaction request “Success”,
Status M status made by the merchant “Failure”
Description M desc Code ID for the status “0000”, “0001”
Order Reference Merchant Generated order
M orderRefNum Character
Number reference number

3.1 Post Method Sample Codes

**Below are the only working codes that we have for post method integration. In case your platform is developed on
some other language then reference codes are available and will be provided on request, but you will have to
customize and develop them as per need.

PHP Sample Code:

[Link]

.Net Sample Code:

[Link]

5|P a g e
3.2 Encryption Algorithm to get value of “merchantHashedReq” Parameter:

In order to mitigate parameter tempering/modification while transfer and posting of data, merchant can encrypt
the request using the hash key generated from your sandbox account. In your request to our online payment system
you have to send ["merchantHashedReq"] parameter. Value for this parameter can be formed by encrypting your
other parameters. Kindly note that all the parameters you were sending previously will be used in generation of the
encrypted value. Moreover, correct sequence of parameters in the concatenated string should be like this:

amount=&autoRedirect=&emailAddr=&mobileNum=&orderRefNum=&paymentMethod=&postBackURL=&storeId=

The secret key to encrypt values can be obtained from Merchant Portal [Account Settings -> Generate Hash Key].

This encrypted request is sent along with the main request, which is then reconciled at OPS end to detect if
parameter is changed or not. The encryption can be done using following algorithm:

1. Create map of all the fields that are part of the request:

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

[Link]("amount", "10.0");
[Link]("storeId", "28");
[Link]("orderRefNum", "11001");
[Link]("expiryDate", "20150101 151515");

[Link]("postBackURL", "[Link]

2. Get the list of field name from the map created in the first step

List fieldNames = new ArrayList([Link]());

3. Sort the map fields based on map key in alphabetical order

[Link](fieldNames)

4. Create a string in following format. Remember that Auto redirect is a mandatory parameter while creating
this string

6|P a g e
amount=10.0&autoredirect=0&expiryDate=20150101151515&orderRefNum=11001&postBackURL=
[Link] 81/local/[Link]&storeId=28

5. Use AES/ECB/PKCS5Padding algorithm to encrypt with the key and string produced in the previous step

Cipher cipher = [Link]("AES/ECB/PKCS5Padding"); SecretKeySpec secretKey = new


SecretKeySpec([Link](), "AES"); [Link](Cipher.ENCRYPT_MODE, secretKey); encryptedValue = new
String(Base64.encodeBase64([Link]([Link]())));

3.3 Hash Encryption Sample Code:

Merchants can use the below given PHP code as a reference for encryption process in Post
Method. For any other language, please follow this reference code to create your own code as
per need

Hash Encryption PHP Sample Code:

[Link]

4. REST APIs

4.1 Purpose

Payment Gateway provides the capability for B2B integrations by exposing core services to
external partners. This enables external partners to reuse their existing interfaces in order to
integrate with Easypaisa. There will be no re-direction to Easypaisa checkout page and external
partner’s system will directly invoke Easypaisa APIs for initiating and inquiring the transaction.

Following three APIs are in-scope:

1 Initiate OTC Transaction


2 Initiate MA Transaction
3 Inquire Transaction Status

The communication protocol supported is REST over HTTPs. External Systems should have the
capability to perform SSL based communication with the Easypaisa Load Balancer.

4.2 Initiate OTC Transaction

The Initiate OTC Transaction method is used to create OTC transactions in OPS

Request URL:

7|P a g e
Staging:
[Link]
Production:
[Link]

Request Header:

Header key Header value Description


Credentials Base64Encoded Partner Account username &
Password for authentication.
They will be provided by
Easypaisa team and the
merchant will have to encode
them to Base64 before including

username:password them in the request

Request Parameters:

Field Name Description Mandatory (M) / Data Type


Optional (O)
orderId Merchant’s system generated M String
Order ID
storeId Store ID M Long
It should be the same id which
is associated with partner
Account credentials sent in the
Header
transactionAmount Total transaction amount M Double
transactionType Type of transaction. M String
Value : OTC

Msisdn Format: M String


03xxxxxxxxx (11 - digits)
emailAddress Format : abc@[Link] M String
tokenExpiry Format : yyyymmdd HHmmss M String
optional1 O String
optional2 O String
optional3 O String
optional4 O String
optional5 O String

8|P a g e
Response Parameters:

Field Name Description Data Type


orderId Merchant’s system generated Order ID String
storeId Store ID generated during merchant Long
registration in Easypaisa
paymentToken Token generated in case of OTC String
transactionDateTime Format : dd/MM/yyyy hh:mm a String
paymentTokenExpiryDateTime Format : dd/MM/yyyy hh:mm a String
optional1 String
optional2 String
optional3 String
optional4 String
optional5 String
responseCode Easypaisa generated response String

responseDesc Possible values are : String

Code : Description

0000 = SUCCESS

0001 = SYSTEM ERROR


0002 = REQUIRED FIELD MISSING

0005 = MERCHANT ACCOUNT NOT ACTIVE

0006 = INVALID STORE ID


0007 = STORE NOT ACTIVE

0008 = PAYMENT METHOD NOT ENABLED

0010 = INVALID CREDENTIALS

0015 = INVALID_TOKEN_EXPIRY

0016 = Expiry date should be future date

Sample Request:

{
"orderId": "abc123",
"storeId": "43",
"transactionAmount": "1.23",

9|P a g e
"transactionType": "OTC",
"msisdn": "03458508726",
"emailAddress": "testEmail@[Link]",
"tokenExpiry": "20190723 232722"
}

Sample Response:

{
"orderId": "abc123",
"storeId": 43,
"paymentToken": "40933012",
"transactionDateTime": "11/08/2018 10:41 PM",
"paymentTokenExpiryDateTime": "23/07/2019 11:27 PM",
"responseCode": "0000",
"responseDesc": "SUCCESS"
}

4.3 Initiate MA Transaction


The Initiate MA Transaction method is used to create MA transactions in OPS

Request URL:

Staging:

[Link]

Production:
[Link]

Request Header:

Header key Header value Description


Credentials Base64Encoded Partner Account username &
Password, for authentication.
They will be provided by
Easypaisa team and the
merchant will have to encode
them to Base64 before including
username:password them in the request

10 | P a g e
Request Parameters:

Field Name Description Mandatory (M) / Data Type


Optional (O)
orderId Merchant’s system generated M String
Order ID
storeId Store ID M Long
It should be the same id which is
associated with partner Account
credentials sent in the header
transactionAmount Total transaction amount M
transactionType M String
Value : MA

mobileAccountNo Format: M
03xxxxxxxxx (11 - digits)
emailAddress Format : abc@[Link] M String
optional1 O String
optional2 O String
optional3 O String
optional4 O String
optional5 O String

11 | P a g e
Response Parameters:

Field Name Description Data Type


orderId Merchant’s system generated Order ID String
storeId Store ID generated during merchant registration in Long
Easypaisa
transactionId Transaction ID of Ericsson (EWP ID) String
transactionDateTime Format : dd/MM/yyyy hh:mm a String
optional1 String
optional2 String
optional3 String
optional4 String
optional5 String
responseCode Easypaisa generated response String
responseDesc Possible values are : String

Code : Description

0000 = SUCCESS
0001 = SYSTEM ERROR
0002 = REQUIRED FIELD MISSING
0005 = MERCHANT ACCOUNT NOT ACTIVE
0006 = INVALID STORE ID
0007 = STORE NOT ACTIVE
0008 = PAYMENT METHOD NOT ENABLED
0010 = INVALID CREDENTIALS
0013 = LOW BALANCE
0014 = ACCOUNT DOES NOT EXIST

Sample Request:
{
"orderId": "abc123",
"storeId": "43",
"transactionAmount": "1.23",
"transactionType": "MA",
"mobileAccountNo": "03458508726",
"emailAddress": "testEnmail@[Link]"

12 | P a g e
}

Sample Response:
{
"orderId": "abc123",
"storeId": 43,
"transactionId": "253184",
"transactionDateTime": "11/08/2018 11:30 PM",
"responseCode": "0000",
"responseDesc": "SUCCESS"
}

4.4 Inquire Transaction Status

The Inquire Transaction Status API is used to inquire transaction information of the referenced
transaction.

Request URL:

Staging:
[Link]

Production:
[Link]

Request Header:

Header key Header value Description


Credentials Base64Encoded Partner Account username &
Password for authentication. They
will be provided by Easypaisa team
and the merchant will have to
encode them to Base64 before
username:password including them in the request

13 | P a g e
Request Parameters:

Field Name Description Mandatory (M) / Data Type


Optional (O)
orderId Merchant’s system generated Order ID M String
as stored in OPS at the time of
transaction initiation
storeId Store ID .It should be the same id which M Long
is associated with partner Account
credentials sent in the header
accountNum Merchant’s EWP Account Number M String
present at Profile Page of Easypaisa
Merchant portal “EWP Account # “

14 | P a g e
Response Parameters:

Field Name Description Data Type


orderId Merchant’s system generated Order ID String
accountNum Merchant’s EWP Account Number String
storeId Store ID generated during merchant Long
registration in Easypaisa
storeName Store Name String
paymentToken Token generated in case of OTC String
transactionStatus Transaction status String
Possible values are :
PAID, FAILED, PENDING, BLOCKED ,
EXPIRED , REVERSED etc.
transactionAmount Total transaction amount Double
transactionDateTime Format : dd/MM/yyyy hh:mm a String
paymentTokenExpiryDateTime Only for OTC String
Format : dd/MM/yyyy hh:mm a
Msisdn Customer MSISDN String
paymentMode Type of transaction . String
Value : MA , OTC , CC
optional1 String
optional2 String
optional3 String
optional4 String
optional5 String
responseCode Easypaisa generated response String
responseDesc Possible values are : String

Code : Description

0000 = SUCCESS
0001 = SYSTEM ERROR
0002 = REQUIRED FIELD MISSING
0003 = INVALID ORDER ID
0004 = INVALID MERCHANT ACCOUNT
NUMBER
0005 = MERCHANT ACCOUNT NOT ACTIVE
0006 = INVALID STORE ID
0007 = STORE NOT ACTIVE
0010 = INVALID CREDENTIALS

15 | P a g e
Sample Request:

{
"orderId " : "MS5007",
"storeId" : "43",
"accountNum" : "654123987"
}

Sample Response
{
"orderId”: "MS5007",
"accountNum" : "654123987",
"storeId" : 43,
"storeName" : "PG Store 1",
"paymentToken" : "40931912",
"transactionStatus" : "PENDING",
"transactionAmount" : 12,
"transactionDateTime" : "09/08/2018 10:04 PM",
"paymentTokenExpiryDateTime" : "09/07/2019 05:06 PM",
"msisdn" : "03458508726",
"paymentMode" : "OTC",
"responseCode " : "0000",
"responseDesc" : "SUCCESS"
}

16 | P a g e
4.5 Possible Reasons of API Response:

Required Field Missing

Any Mandatory field is missing.


Incorrect email format in initiate MA or OTC requests.
Incorrect MSISDN format in initiate OTC request.
Incorrect mobile Account No format in initiate MA request.
Transaction amount is sent less than or equal to Zero in the initiate MA or OTC requests.

4.6 Optional Parameters

These parameters are present in the requests and responses of all three APIs mentioned above and are
optional in each case.
If these attributes are provided in the request, then OPS will save the values of these parameters in OPS database
against the transaction and return them in the response.
These parameters are available for selection in the ‘IPN Attribute Configurations’ screen in the Account Settings tab
of the Merchant Portal.
If selected, these optional parameters will also be sent in the merchants’ IPN to the configured URL.

5. Instant Payment Notification:

Instant payment notification message is used to notify merchants about the details of any particular
transaction made by customers using Easypaisa channel. IPN message is self-configured in Easypaisa
for each merchant. It is customized as to what details merchant requires in response for any
particular transaction. The IPN message service sends merchant a notification whenever Easypaisa
transaction is created (with ‘Paid’ status) or is updated to ‘Paid’.

IPN Handler URL is the Merchant’s IPN listener URL where Merchant will be expecting the response
from Easypaisa. IPN message will contain the selected parameters configured for merchant using
below mentioned screen in merchant portal.

5.1 What you need to do:

1. Configure the listener URL on Easypaisa merchant portal by going to the account setting tab and
clicking on the IPN attributes configuration
2. Select desired IPN attributes from the Easypaisa merchant portal
3. Create a listener that will receive in GET request variable named ‘url’
4. The received URL would be that of REST API which will return the IPN attributes
**See reference screenshot below

17 | P a g e
Following is the format for URL:

MerchantURL?URL=Rest API URL/Merchant Account ID/Order ID

Where URL = is the reserved word added by the system.

For Example:
Merchant URL = [Link]
Rest API URL = [Link]
service/rest/v1/order- status Merchant Account ID =
00001 Order ID = 998877

IPN Message:[Link] [Link]


service/rest/v1/order- status/1000223344/998877

18 | P a g e
6. Testing Credentials for Sandbox (Test Account)

Once the integration with Easypaisa is completed, merchants can test the payment flows using
the following Credentials for Mobile Account and Credit Card Transactions.

**Each case must be tested as per screenshot below. There are a total of seven cases that are must to be tested.
Without which merchant cannot go live.

For Easypaisa Shop payment method testing:

1- Generate an order
2- Pay with Easypaisa (Shop payment method)
3- Fill details on Easypaisa payment page
4- Copy the token number that has been generated
5- On the same page where token number is displayed, you will see an option ‘Pay Token’, click that option and
paste the token number in it and click enter
6- Transaction should be marked as paid in Easypaisa portal

7. How to Go Live with your Easypaisa Account:


Once all the payment methods are tested on sandbox, you can then move to production (live account) if it has been
created (depending on your account opening documentation status at Telenor Bank).

19 | P a g e
7.1 Live Account Activation
Your Live account will be created by your designated Telenor POC. You will receive an email from
[Link]@[Link] on your provided email ID containing the link to your live account activation
along with the one time password sent on your registered number that you shared for sandbox creation.

Steps:

  Click the activation link in the email

  Enter your username. Your Username will be the email address provided by you for live account

  Enter OTP (one time password). Sent to you on your number

  Set a new password


You’re good to go!

Once you have successfully logged in to your live account. You will need two things in order to move from
Staging to Live.

1-Store ID: To find your store ID, login to the OPS Portal and click on the profile button on top right

2-Hashkey (Used only in Post Method for Credit Card Transactions): To generate your Hashkey. Go to Account
Settings>Generate Hashkey

Changes Required for POST Method Integration (to move to live):

Kindly follow the below mentioned steps in order to move from testing to live Easypaisa environment if you are using
the POST method integration

 Change your Store ID from staging with the one you will get in your live account

 Generate Hashkey from your live account .To generates your Hashkey. Go to Account Settings>Generate
Hashkey and replace it with the one you used for hash encryption in staging environment.

 Change the [Link] and [Link] URL’s with the one’s given below

[Link]

[Link]

Changes required for OPEN API integration:

Kindly follow the below mentioned steps in order to move from testing to live Easypaisa environment if you are using
the OPEN API integration method.

Simple change the SOAP based WSDL URL of API to the one provided below
([Link]
service/PartnerBusinessService/METAINF/wsdl/partner/transaction/[Link])
Your SOAP credentials for live account (Username & Password ) will be shared with you
by your Easy pay POC



20 | P a g e
8. Hosted Checkout Integration

Introduction

Easypay Online Payment System (OPS) is an electronic payment solution that enables internet users to make financial
transactions online. It seamlessly integrates with e-commerce web-sites, shopping carts or mobile apps and allows the
owners of these applications to collect payments from their customers. Easypay allows partner businesses to offer their
customers a variety of payment methods to pay for their transactions, which include Easypaisa Mobile Accounts,
Credit/Debit Card payments.

Hosted Checkout

Hosted Checkout is an extension offered by Mastercard Payment Gateway Services (MPGS) allowing online merchants
and e-commerce/webstores to offer customers to pay for their transactions through credit/debit cards directly from the
webstore using a payment gateway, without re-directing to the payment gateway’s web-page. Easypay OPS offers this
feature to merchants or web-stores using Easypay as their payment gateway.
Hosted Checkout allows online merchants to copy a pre-built form in their web-sites’ code, to collect payment
information from their customers. This form allows customers to input credit card information in the web-site without
exposing it to the merchant. Merchant webstores will never handle this information directly. The form will automatically
retrieve the information and forward it to Easypay payment gateway for processing..
After integration with the hosted checkout page, merchant can take credit card transaction input (Card Number, CVV,
Card Expiry etc.) on their website and send the transaction for processing to Easypay. The credit card details entered on
merchant website are secured and cannot be extracted or stored by the web-store’s server or database

Security

8.1 Hosted Fields:


Hosted Fields is a feature that allows web developers to outsource the handling of payment card data while developing an
ecommerce web-store.
Hosted Fields are input fields that appear on any webpage, but which use JavaScript to ensure that the information
entered in these fields is securely handled by an authorized payment gateway such as Easypay’s servers rather than
merchants’ websites/servers where the input fields actually appear. This makes payment processing easier to implement,
relieves merchant of having to handle payment details such as credit/debit card information and also prevents
unauthorized webstores from storing credit card information.

8.2 Checkout Form:


Checkout Form is the html form which contains Hosted Fields required to input card details. The form works together with
the Easypay Hosted Checkout JavaScript file linked with the web-page to secure information retrieval. The form ensures
that client side interaction will be between customer browser and OPS server. Merchant and web hosting providers will
not have any control.

8.3 Hash Parameter Generation


The checkout form also generates a hash string from the user’s transaction details and sends it to OPS as an additional
parameter. This hash is used by Easypay to identify whether the request has been sent from an authorized merchant
webstore.

21 | P a g e
8.4 Encrypt Card Holder Information
According to PCI DSS regulations, card holders’ data must be protected from merchant applications that are not PCI DSS
compliant.
The card details in the hosted fields is extracted from customers’ browsers by the Hosted Checkout form and is
transmitted to OPS Server for payment processing in an encrypted form. The encryption prevents any merchant
interference and also protects sensitive information from leaking over the network layer.
OPS uses the process of Public Key Encryption to secure credit card and card holder information. When users submit their
card details via pay button in an e-commerce website, then the Hosted Checkout JavaScript requests the Easypay OPS
server for a Public key. This key will be used for transaction information encryption. OPS will encrypt the credit card
information using this key and send the encrypted string to OPS for further processing.

After receiving an encrypted request from hosted checkout form, OPS will decrypt the request using its’ private key. OPS
stores its’ private keys in AES encrypted form. These private keys are OPS’ own secret and are not shared with anyone or
any third party system.

22 | P a g e
How it works

The checkout page of a web-store, using Hosted Checkout form can be classified into four sections based on their
behavior when opened in a customer’s browser.
The customer details section contains input fields that collect customer details such as first and last name, address etc.
The information from this section is embedded and controlled by the merchants’ own web-sites and can be accessed by
their web-servers.
The Hosted Checkout URL is a link to the Easypay JavaScript file that must be linked with the merchants’ website. This file
is used by the Hosted Checkout form in the merchant web-site to secure payment details.
The Hosted Checkout form contains the input fields that collect credit card information i.e. Card number, CVV and Expiry
date etc. This form uses the JavaScript files mentioned above, to ensure that the information entered in the hosted fields
is only held by the payment gateway and cannot be accessed by merchants’ websites.
The payment processor iframe comes with the Hosted Checkout form and is used to display the payment processor’s
page, within the merchant web-site. The web-page displayed in this iframe is controlled by OPS. OPS in turn is connected
with the Mastercard and displays the resulting HTML from Mastercard in this iframe.

23 | P a g e
8.5 Hosted Checkout User Journey

Step1

The Hosted Checkout form appears on an online store and asks for payment information input from user.

Step2

User enters his/her card details in the Hosted Checkout form and clicks on pay button.

24 | P a g e
Step3

The card details form will be hidden and an iframe will appear in its place showing the payment facilitator’s processing
page.

25 | P a g e
Step4 (Conditional)

If the customer’s card is 3d Secured, then the 3DS enrollment check page appears within the iframe.

Step5

After all processing, it will automatically redirect to the merchants’ configured thank you page with a set of parameters as
shown below.

26 | P a g e
8.6 How to integrate
The following sequence of steps needs to be performed to integrate Easypay Hosted Checkout with a merchant website.

Step1

Include the Hosted Checkout form in the order checkout page of the web-store. The following code snippet can be used
within the html code body.
<div id="hosted-checkout-container">
<div id="opsMessagesSpan" class="error"></div>
<iframe id="easypay-iframe" name="easypay-iframe" style="display:none;" width="100%" height="430px"></iframe>
<form id="hosted-checkout-form">
<table class="table table-borderless">
<input type="hidden" id="storeId" value="<?php echo $storeId; ?>">

27 | P a g e
<input type="hidden" id="orderRefNumber" value="<?php echo $orderRefNum; ?>">
<input type="hidden" id="amount" value="<?php echo $amount; ?>">
<input type="hidden" id="bankIdentificationNumber" value="<?php echo $bankIdentificationNumber; ?>">
<input type="hidden" id="postBackURL" value="<?php echo $postBackURL; ?>">
<tr>
<td>Card Number</td>
<td>
<input type="text" id="ccNumber" required/>
</td>
</tr>
<tr>
<td>CVV Code</td>
<td>
<input type="text" id="cvv" required/>
</td>
</tr>
<tr>
<td>Expiry Month</td>
<td>
<select id="expMonth">
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>
</td>
</tr>
<tr>
<td>Expiry Year</td>
<td>
<select id="expYear">
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
</select>
</td>
</tr>
<tr>
<td>Email</td>
<td>
<input type="text" id="email" value="" required/>
</td>
</tr>
<tr>
<td>Cell</td>
<td>
<input type="text" id="mobileNum" value="" required/>
</td>
</tr>
</table>
<div id="post">
<input type="submit" value="Pay" /><span id="validation-message"></span> </div>
</form>
</div>

28 | P a g e
The following input fields come pre-built in the Checkout form:
 Card Number
 CVV Code
 Expiry Month
 Expiry Year
 Email
 Cell
 Pay

The element name and “id” attribute of every element/tag within the form must be kept the same as in the code snippet
above. These IDs are used by the Hosted Checkout JavaScript file to identify the input fields.
Styling of elements within the form can be customized as needed.

Step2

Include links to the following files towards the end of the body in script tags with the link in the “src” attributes and
“text/javascript” in the “type” attribute.
1- [Link]
2- [Link]
<script src="[Link] type="text/javascript"></script>
<script src="http:// [Link] /hosted-checkout/js/[Link]" type="text/javascript"></script>

Step3

Save and close the file.

Step4

Your web-site should now be integrated with the Hosted Checkout and should now successfully communicate with
Easypay OPS.

8.7 Pre-requisites
In order to use Easypay Hosted Checkout, an active online merchant account is required for your store in Easypay OPS
with the following configurations:
 CC Payment method enabled
 Hosted Checkout enabled
 Valid merchant credentials
 A valid hash-key for your account
 Hosted Checkout form and JavaScript integrated successfully

"<https:// [Link] /hosted-checkout/js/[Link]>"


"[Link]

29 | P a g e
30 | P a g e

1 | P a g e  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Easypaisa 
 
Integrat
2 | P a g e  
 
Table of Contents 
1. How to activate your sandbox test account: ............................................
3 | P a g e  
 
1. How to activate your sandbox test account: 
 
Your Sandbox (testing) account will be created by your desig
4 | P a g e  
 
 
3. Post Method Integration for Credit Card Transactions 
 
 
Post method is a seamless 2 step process 
 
ST
5 | P a g e  
 
Bank 
O 
bankIdentifier 
If the merchant wants to pass the 
6 digit alphanumeric value 
Identifier 
 
 
custo
6 | P a g e  
 
3.2 Encryption Algorithm to get value of “merchantHashedReq” Parameter: 
 
In order to mitigate parameter tem
7 | P a g e  
 
 
amount=10.0&autoredirect=0&expiryDate=20150101151515&orderRefNum=11001&postBackURL=
http://localhost:90 81/
8 | P a g e  
 
Staging: 
 
https://easypaystg.easypaisa.com.pk/easypay-service/rest/v4/initiate-otc-transaction 
Production:
9 | P a g e  
 
Response Parameters: 
 
 
 Field Name 
  Description 
  
Data Type 
 
 
orderId 
  Merchant’s system generate
10 | P a g e  
 
 
"transactionType": "OTC", 
"msisdn": "03458508726", 
 
"emailAddress": "testEmail@gmail.com", 
"tokenExpir

You might also like