EPG Technical Documentation v1.7 2
EPG Technical Documentation v1.7 2
EPG Technical Documentation v1.7 2
12 September 2021
Confidentiality Notice
This document is confidential. Arab Payment Services strictly prohibits any reprinting,
copying, translating and any sort of reproducing of this document, whether it is partially or
completely.
Revisions
Date Revision Author Description
16/09/2018 1.0 Abdullah Adel Document Preparation
19/ 10/2018 1.1 Hussein Shaker Document Preparation
03/12/2020 1.2 Salah Hassan Change API link
04/08/2021 1.3 Salah Hassan Change API Request
06/07/2021 1.4 Salah Hassan Add getOrderStatusExtended.do,
Remove refund,
Remove reversal
12/09/2021 1.5 Salah Hassan API to get list of transactions
07/11/2021 1.6 Salah Hassan Add New field (Phone) to send an
SMS notification to the customer
01/06/2022 1.7 Salah Hassan Remove Fail URL and the
merchant should be sent Get
Order Status to check the
Payment.
© 2021 Arab Payment Services
1. Introduction
Internet acquiring is used to sell goods and services via the public Internet, allowing
customers to use their regular bank cards to make purchases. A merchant planning to sell
goods or services via the
Internet must ensure the security of the payments being processed by taking the following
measures.
• Key data (such as personal data and bank cards details) must be transferred via a
secure (SSL or TLS) connection.
• Before the payment is made, the customer’s card parameters (for example, the expiry
date, cardholder name and so on) should be checked.
The 3-D Secure protocol is used to provide an additional security layer. The major payments
networks have introduced their own services based on the 3-D Secure protocol, for example,
MasterCard has “Mastercard SecureCode” and Visa has “Verified by Visa. ”
2. Merchant Requirements
The merchant should have developed a website that can interact with APS E-commerce
Payment Gateway. There is no specific programming language required, the website can be
developed using any language that can send/receive HTTP requests. The merchant website
should be integrated with a database to store all orders made by the customers as an order
ID will be required by the EPG to process the order.
The flow starts with the merchant making an order registration request, after the request is
approved by EPG, the customer will be redirected to APS payment page. The customer will
input its information, submits the payment, and get redirected based on the operation result.
3. REST Interface
Interactions between the merchant and the APS E-commerce Payment Gateway are
implemented as HTTP requests with POST method to specific URLs. These are separate for
each individual request type.
The parameters used in the interactions are sent as parameters of POST request; their values
must be URL-encoded in the request body with the content type application/x-www-form-
URL-encoded.
For authorization purposes, each request must include the login and password of the
merchant that were generated during its registration. The values are sent as the following
parameters:
All text fields must use UTF-8 encoding. In REST requests special characters must be
encoded using URL encoding. The table of characters can be viewed at the following URL:
Note: The error code does not display the order status. To view the status of an order, use
the getOrderStatus.
Response Parameters:
Name Type Mandatory Description
orderId ANS36 No Unique order number in the APS
Ecommerce Payment Gateway.
It is absent if the order registration
has failed
(the error is described in the
ErrorCode field).
formUrl AN..512 No URL of the payment page to which the
customer should be redirected. If the
order registration has failed, this
parameter is absent (the error is
described in the ErrorCode field).
errorCode N3 No Response code: 0 in the case of a
successful transaction, other code if
an error occurred when processing
the request.
errorMessage AN..512 No Description of the error in the
language that was sent in the
language parameter of the request.
Value Description
0 No system error.
Order with given order number has already been processed or the
childId is incorrect.
1
Order with this number was registered, but was not paid.
Sub-merchant is blocked or deleted.
3 Unknown currency.
Order number is not specified.
Merchant user name is not specified.
4 Amount is not specified.
Return URL cannot be empty.
Password cannot be empty.
Incorrect value of a request parameter.
Incorrect value in the Language parameter.
5 Access is denied.
Merchant must change the password.
Invalid jsonParams[].
7 System error.
userName=API_USERNAME&password=API_PASSWORD&orderNumber=SALAH_26911719&amount
=100000¤cy=368&returnUrl=https://www.google.com&language=ar&description=Test&sessi
onTimeoutSecs=5000
userName=API_USERNAME&password=API_PASSWORD&orderNumber=SALAH_26911719&amount
=100000¤cy=368&returnUrl=https://www.google.com&language=ar&description=Test&sessi
onTimeoutSecs=5000
Response example
{"errorCode":0,"orderId":"778a7ebf-88d5-4407-94b3-dfcab6e51f56","formUrl":"https://uat-
proxy.aps.iq:5443/epg/merchants/test/payment_ar.html?mdOrder=778a7ebf-88d5-4407-94b3-
dfcab6e51f56"}
3.2 Order status request
To obtain the current state of a registered order, send data with getOrderStatus.do method
(GET or POST) to the corresponding URL. The order status is determined by the value of
the OrderStatus parameter. Note: The authCode field is deprecated.
Request Parameters:
Name Type Mandatory Description
userName AN..30 Yes Merchant login received during
registration.
password AN..30 Yes Merchant password received during
registration.
orderId ANS36 Yes Unique order number in the
APS Ecommerce Payment
Gateway.
language A2 No Language code in the ISO 639-1
format.
If unspecified, APS E-commerce
Payment Gateway uses the default
language from the merchant
settings. Error messages are
returned in this language.
Response Parameters:
Name Type Mandatory Description
OrderStatus N3 No Displays the order status in APS
Ecommerce Payment Gateway.
Possible values are listed in the
table below. This parameter is
absent if no order with the
specified ID is found.
ErrorCode N3 No Error code.
ErrorMessage AN..512 No Description of the error in the
language that was sent in the
language parameter of the request.
OrderNumber AN..32 Yes Identifier of the order in the
merchant system.
Pan N..19 No Masked number of the card that
was used in payment. It is specified
only for paid orders.
expiration N6 No Card expiration date in the YYYYMM
format. It is specified only for paid
orders.
cardholderName A..64 No Cardholder name. It is specified only
for paid orders.
Amount N..20 Yes Order amount in the minor
denomination (for example, cents).
currency N3 No Payment currency code in the ISO
4217 format.
approvalCode AN6 No Payments network authorization
code. The field has fixed length of
six characters; it can contain both
numbers and letters.
Value Description
0 No system error.
2 The order is declined because of an error in the payment credentials.
Access is denied.
5 The user must change the password.
orderId is empty.
6 Unregistered OrderId.
7 System error.
orderId=8d9364ce-916f-4f96-8f60-
4c3194e7cb1f&language=en&password=API_PASSWORD&userName=API_USERNAME
orderId=8d9364ce-916f-4f96-8f60-
4c3194e7cb1f&language=en&password=API_PASSWORD&userName=API_USERNAME
Response example
{"expiration":"202301","cardholderName":"SDSD","depositAmount":0,"currency":"368","authCode":2,"ErrorC
ode":"2","ErrorMessage":"Payment is
declined","OrderStatus":6,"OrderNumber":"SALAH_30","Pan":"521097******0454","Amount":1000000,"Ip":"
192.168.2.248"}
Request Parameters:
Name Type Mandatory Description
userName AN..30 Yes Merchant login received during
registration.
password AN..30 Yes Merchant password received during
registration.
orderId ANS36 Yes Unique order number in the
APS Ecommerce Payment
Gateway.
language A2 No Language code in the ISO 639-1
format.
If unspecified, APS E-commerce
Payment Gateway uses the default
language from the merchant
settings. Error messages are
returned in this language.
Response Parameters:
There are many templates for this API, So kindly check with APS team about the response.
Value Description
0 No system error.
2 The order is declined because of an error in the payment credentials.
Access is denied.
5 The user must change the password.
orderId is empty.
6 Unregistered OrderId.
7 System error.
orderId=8d9364ce-916f-4f96-8f60-
4c3194e7cb1f&language=en&password=API_PASSWORD&userName=API_USERNAME
Request parameters
Name Type Manda- Description
tory
Response parameters
Value Description
1 The preauthorized amount has been put on hold (for two-phase payments).
3 Authorization is canceled.
6 Authorization is declined.
Value Description
0 The request has been processed without system errors.
5 Access is denied.
7 System error.
Add example
userName=USER_NAME&password=PASSWORD&page=0&size=100&from=201808091
60000&to=20210909160000&transactionStates=DEPOSITED,DECLINED&merchants=M
ERCHANT_NAME&searchByCreatedDate=false
userName=USER_NAME&password=PASSWORD&page=0&size=100&from=201808091
60000&to=20210909160000&transactionStates=DEPOSITED,DECLINED&merchants=M
ERCHANT_NAME&searchByCreatedDate=false
Response example
As json
This flow shows the merchant the request processing.