ARB Payment Gateway 3.3.0.ARB - REST API Integration Guide - V1.10
ARB Payment Gateway 3.3.0.ARB - REST API Integration Guide - V1.10
GATEWAY MERCHANT
IMPLEMENTATION
GUIDE - REST APIS
Version 1.10
[Abstract]
Version History
Created or Up-
Version No. Reason for Change Created or Updated on
dated By
1.0 FSS Merchant integration using REST API Jan 23, 2020
Table of Contents
The Payment Gateway follows industry standards and norms as prescribed by MasterCard and Visa
International as well in conformity with Payment Card Industry – Data Security Standards commonly
referred to as PCI – DSS.
In order that the AL Rajhi Bank merchants are integrated in a secure and mandated manner, this
reference document is being shared. The expectation being that the merchant’s system integrator
or auditor can refer to a document while performing integration as well as post integration. It con-
tains the technical integration details including message formats to be used in communicating to
the Payment Gateway irrespective of the merchant platform being used. The document also shares
the best practices and recommendations the merchant should follow during the integration with
Payment Gateway.
ARB PG API’s are complete RESTFUL API’s; Merchants can test the API’s on sandbox setup before
testing on Live environment.
Below are the prerequisites for merchants to integrate with ARB Payment gateway. These are shared
to the merchant via mail to their registered email ID.
1. Tranportal ID
2. Tranportal Password
3. Resource Key
4. Payment gateway endpoint
Integration Process
https://digitalpayments.alrajhibank.com.sa/mrchptl/merchant.htm
To verify if a transaction has been settled or not merchant can always refer the transaction detail
report in merchant Portal . Navigation to transaction detail report in merchant portal is as below :
Payment Gateway uses AES encryption algorithm to encrypt transaction data which includes all sensitive
information such as Card number, Expiry period, CVV etc.,
There are two ways of processing the payment with ARB payment gateway with API integration.
Bank hosted integration type can be used by merchants who cannot accept card credentials on
their website.
▪ Customer completes the purchase and proceeds to checkout with payment options
▪ Merchant is redirected to Bank’s payment page, wherein customer inputs the card details
on Bank’s page.
▪ Card details are validated & Merchant invokes payment API
▪ Payment Gateway then will interface with respective schemes like MasterCard, VISA to pro-
cess the 3D secure authentication.
▪ Once the authentication is completed by respective scheme / ACS, PG will perform Risk
check.
▪ Once the authentication step is completed, Payment gateway completes the transaction
authorization and provides the response to the merchant.
Merchant Hosted
o Merchant hosted type is an integration flow in which merchant can accept card credentials on
their website which provides rich user experience and pass on to AL Rajhi PG.
o ARB PG processes the transaction and returns the response. In this scenario, the merchant has
to be PCI compliant.
o Customer completes the purchase and proceeds to checkout with payment options
o Merchant displays payment page and customer inputs the card details
o Card details are validated & Merchant invokes payment API
o Payment Gateway then will interface with respective schemes like MasterCard, VISA to process
the 3D secure authentication.
o Once the authentication is completed by respective scheme / ACS, PG will perform Risk check.
o Once the authentication step is completed, Payment gateway completes the transaction author-
ization and provides the response to the merchant through API
• Trandata will contain below parameters encrypted with AES algorithm with CBC Mode, PKCS5Pad-
ding with initialization vector value PGKEYENCDECIVSPC under Resource Key
Plain Trandata:
[{“amt”:”12.00”,”action”:”1”,”pass-
word”:”q@a68O$27@JLkcK”,”id”:”IPAYlCR6qZF7q6w”,”curren-
cyCode”:”682”,”trackId”:”12345656789”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”u
df3text”,”udf4”:”udf4text”,”udf5”:”udf5text”,”re-
sponseURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp”,”er-
rorURL”:http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp,
"accountDetails":[{"bankIdCode": "12345d6f", "iBanNum":
"567896743281926354276254","serviceAmount":"200.00","valueDate":"20203112"
},{"bankIdCode": "1234ret3", "iBanNum": "987656743281926354276254","serviceA-
mount":"300.00","valueDate":"20213112" }]
}]
Request from Merchant to ARB Payment gateway
ac-
13 C JSON Array Split Payment Details.
countDetails
serviceA-
13.3 C Numeric Service Amount
mount
• ARB Payment gateway internally validates the request and gives payment ID and payment page
URL in the response in case of successful validation, if failure then error code and description will be
provided. The below response will be in plain format and there is no encryption for the below.
Merchant can directly parse the response-based status and result fields as mentioned below.
Success:
[{"status": "1","result":"100201931620827468:http://10.44.71.241:8080/AR-
BiPay3.3.0_AlRajhibank/paymentpage.htm" //Payment ID:Paymentpage URL
“error”:null,
“errorText”:null}]
Failure:
[{
"status": "2","error":" IPAY0100124”,
“errorText”:” Problem occurred while validating transaction data”
“result”:null
}]
Initial Response from PG to Merchant
1 status M Numeric If the request validation success, then status will be ‘1’. If the
validation failed, then status will be ‘2’
2 result M Alphanum It contains payment ID and Payment URL if the validation suc-
cess else this will be null
3 error C Alphanum If validation failed, then Payment gateway will provide the re-
spective error code
4 errorText C Alphanum If validation failed, then Payment gateway will provide the re-
spective error description
• If success, Merchant needs to frame the payment page URL like the below sample
http://10.44.71.241:8080/ARBiPay3.3.0_AlRajhibank_restAPI/paymentpage.htm?Paymen-
tID=100201931620827468
• If Merchant notification is disabled, then ARB Payment gateway will provide the final response in
URL redirection. Below is the sample response from ARB PG to merchant
[{“paymentId”:100201935166676976,“trandata”:”<encrypted trandata>”,
“error”:””,“errorText”:””}]
• Plain Trandata:
[{“paymentId”:100201935166676976,”result”:”CAPTURED”,”transId”:201935166561122,
”ref”:”935110000001”,”date”:1217,”trackId”:”1003383844”,”udf1”:””,”udf2”:””,”ud
f3”:”8870091137”,”udf4”:”FC”,”udf5”:”Tidal5”,”amt”:”70.0,”authRespCode”,”00”,"a
uthCode":"000000"}]
1 paymentId M Numeric Unique payment Id generated by PG and merchant can use this
ID to match the response from PG
2 trandata C Alphanum All the below response parameters encrypted and send the en-
crypted value in trandata
3 error C Alphanum If any error, PG will send the error code
7 udf1 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
8 udf2 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
9 udf3 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
10 udf5 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
11 amt M Numeric Transaction amount
Faster Checkout functionality is supported for the merchants only when Faster Checkout flag is enabled
at the terminal level.
Payment gateway supports faster checkout option where customer can register card details based on
unique customer ID which merchant have to send for payment transactions
• Trandata will contain below parameters encrypted with AES algorithm with CBC Mode, PKCS5Pad-
ding with initialization vector value PGKEYENCDECIVSPC under Resource Key
Plain Trandata:
[{“amt”:”12.00”,”action”:”1”,”pass-
word”:”q@a68O$27@JLkcK”,”id”:”IPAYlCR6qZF7q6w”,”curren-
cyCode”:”682”,”trackId”:”12345656789”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”u
df3text”,”udf4”:”udf4text”,”udf5”:”udf5text”,”re-
sponseURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp”,”er-
rorURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp”,
"accountDetails":[{"bankIdCode": "12345d6f", "iBanNum":
"567896743281926354276254","serviceAmount":"200.00","valueDate":"20203112"
},{"bankIdCode": "1234ret3", "iBanNum": "987656743281926354276254","serviceA-
mount":"300.00","valueDate":"20213112" }],
"custid":"201936122890007","cust_cardHolderName":"Test","cust_mobile_num-
ber":"7788667755","cust_emailId":"[email protected]"}]
• For Faster Checkout Transactions below are the additional parameters sent in the request of bank
hosted transactions :
Additional request Parameters in Bank Hosted Transactions for Faster Checkout Function-
ality.
• Payment gateway will provide the final response in URL redirection. Below is the sample response
from ARB PG to merchant
[{“paymentId”:100201935166676976,“trandata”:”<encrypted trandata>”,“error”:””,“er-
rorText”:””}]
Plain Trandata:
[{“paymentId”:100201935166676976,”result”:”CAPTURED”,”tran-
sId”:201935166561122,"fcCus-
tId":"201936122890007",”ref”:”935110000001”,”date”:1217,”trackId”:”1003383844”,
”udf1”:””,”udf2”:””,”udf3”:”8870091137”,”udf4”:”FC”,”udf5”:”Tidal5”,”amt”:”70.0
,”authRespCode”,”00”,"authCode":"000000"}]
Additional response Parameter in Bank Hosted Transactions for Faster Checkout Func-
tionality.
Payment gateway shall support Iframe integration to enable merchants to accept online payments on
own checkout page and without having to be a PCI compliant. Instead of being redirected to ARB Pay-
ment page, customers will remain on merchant website to make payments. However, at the back end,
ARB PG will securely collect the payment information and get it authorized.
Merchant needs to send value 'iframe' in the UDF3 field of the request as below
• Trandata will contain below parameters encrypted with AES algorithm with CBC Mode, PKCS5Pad-
ding with initialization vector value PGKEYENCDECIVSPC under Resource Key
Plain Trandata:
[{“amt”:”12.00”,”action”:”1”,”pass-
word”:”q@a68O$27@JLkcK”,”id”:”IPAYlCR6qZF7q6w”,”curren-
cyCode”:”682”,”trackId”:”12345656789”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”i
frame”,”udf4”:”udf4text”,”udf5”:”udf5text”,”re-
sponseURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp”,”er-
rorURL”:http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp,
"accountDetails":[{"bankIdCode": "12345d6f", "iBanNum":
"567896743281926354276254","serviceAmount":"200.00","valueDate":"20203112"
},{"bankIdCode": "1234ret3", "iBanNum": "987656743281926354276254","serviceA-
mount":"300.00","valueDate":"20213112"}]
}]
• ARB Payment gateway internally validates the request and gives payment ID and payment page
URL in the response in case of successful validation, if failure then error code and description will be
provided. The below response will be in plain format and there is no encryption for the below.
Merchant can directly parse the response-based status and result fields as mentioned below.
Success:
Failure:
http://10.44.71.241:8080/ARBiPay3.3.0_AlRajhibank_restAPI/paymentpage.htm?Paymen-
tID=100201931620827468
Merchant needs to add the following code snippet to load the payment page in an iframe window:
Code Snippet
if("iframe".equals(pipe.getUdf3()))
{
%>
<script>
if(window.parent.document.getElementById("iframe")!=null)
{
var division=document.createElement("div");
division.setAttribute("id", "payframe");
division.setAttribute("style", "min-height: 100%; position: fixed; top:
0px; left: 0px; width: 100%; height: 100%; background: rgba(0, 0, 0, 0); padding-
right: 0px; padding-left: 0px;padding-top: 0px;");
division.innerHTML ='<div style="position: absolute;right: 0px;top:
0px;cursor: pointer;font-size: 24px;opacity: .6;width: 100%;text-align: cen-
ter;line-height: 0px;z-index: 1;" class="close" id="F" onclick="javascript: win-
dow.parent.document.getElementById(\'iframe\').parentNode.removeChild(window.par-
ent.document.getElementById(\'iframe\'));window.parent.document.getEle-
mentById(\'payframe\').parentNode.removeChild(window.parent.document.getEle-
mentById(\'payframe\'));">x</div><iframe id="iframe" style="opacity: 7; height:
100%; position: relative; background: none; display: block; border: 0px none trans-
parent; margin-left: 0%; padding: 0px; z-index: 2; width: 100%; margin-top: 0%" al-
lowtransparency="true" frameborder="0" allowpaymentrequest="true"
src="<%=pipe.getWebAddress()%>"></iframe>';
document.body.appendChild(division);
}
else
{
var division=document.createElement("div");
division.setAttribute("id", "payframe");
• Payment gateway will provide the final response in URL redirection. Below is the sample response
from ARB PG to merchant
[{“paymentId”:100201935166676976,“trandata”:”<encrypted trandata>”,“error”:””,“er-
rorText”:””}]
Plain Trandata:
[{“paymentId”:100201935166676976,”result”:”CAPTURED”,”tran-
sId”:201935166561122,"fcCus-
tId":"201936122890007",”ref”:”935110000001”,”date”:1217,”trackId”:”1003383844”,”udf
1”:””,”udf2”:””,”udf3”:”8870091137”,”udf4”:”FC”,”udf5”:”Tidal5”,”amt”:”70.0,”authRe
spCode”,”00”,"authCode":"000000"}]
[{"id":"IPAYlCR6qZF7q6w",“trandata”:”<encrypted trandata>”,"re-
sponseURL":"http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp","er-
rorURL":"http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp" }]
• Trandata will contain below parameters encrypted with AES algorithm with CBC Mode, PKCS5Pad-
ding with initialization vector value PGKEYENCDECIVSPC under Resource key.
Plain Trandata
[{“amt”:”12.00”,”action”:”1”,”password”:”q@a68O$27@JLkcK”,”id”:”IPAYlCR6qZF7q6w”,”curren-
cyCode”:”682”,”trackId”:”123456”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”udf3text”,”udf4”:”u
df4text”,”udf5”:”udf5text”,”responseURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/Host-
edPaymentResult.jsp”,”errorURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentRe-
sult.jsp”,”expYear”:”2022”,”expMonth”:”12”,”member”:”cardholder-
name”,”cvv2”:”212”,”cardNo”,”5453********5539”,”cardType”:”C”,
"acountDetails":[{"bankIdCode":"12345d6f","iBanNum":"567896743281926354276254","ser-
viceAmount":"200.00","valueDate":"20203112"},{"bankIdCode":"1234ret3","iBan-
Num":"987656743281926354276254","serviceAmount":"300.00","valueDate":"20213112" }]
}]
Plain Trandata for Credit Card Installment Transactions(udf6 and udf7 additional param-
eters)
[{“amt”:”12.00”,”action”:”1”,”password”:”q@a68O$27@JLkcK”,”id”:”IPAYlCR6qZF7q6w”,”curren-
cyCode”:”682”,”trackId”:”123456”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”udf3text”,”udf4”:”u
df4text”,”udf5”:”udf5text","udf6":"12345","udf7":"C",”re-
sponseURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentResult.jsp”,”er-
rorURL”:”http://10.44.71.241:8089/pgdemo/jsp/ARB/HostedPaymentRe-
sult.jsp”,”expYear”:”2022”,”expMonth”:”12”,”member”:”cardholder-
name”,”cvv2”:”212”,”cardNo”,”5453********5539”,”cardType”:”C”,
"acountDetails":[{"bankIdCode":"12345d6f","iBanNum":"567896743281926354276254","ser-
viceAmount":"200.00","valueDate":"20203112"},{"bankIdCode":"1234ret3","iBan-
Num":"987656743281926354276254","serviceAmount":"300.00","valueDate":"20213112" }]
}]
7 udf1 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then re-
turned in the transaction response. Merchant should en-
sure that field is left blank when no data needs to be
passed.
8 udf2 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then re-
turned in the transaction response. Merchant should en-
sure that field is left blank when no data needs to be
passed.
9 udf3 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then re-
turned in the transaction response. Merchant should en-
sure that field is left blank when no data needs to be
passed.
10 udf5 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then re-
turned in the transaction response. Merchant should
UDF 6 and UDF7 parameters should be passed only for Credit Card installment Transactions as be-
low:
20 udf6 O Alphanum Credit Card Installment Short Code
• ARB Payment gateway internally validates the request and gives payment ID and payment page
URL in the response if the validation success. If failure then, Error code and description will be
provided.
Plain Response:
Success:
[{"status": "1",
"result":"100201931620827468:http://10.44.71.241:8080/FSSiPay3.3.0_AlRajhi/Tranpor-
talVbv.htm", //Payment ID:Payment page URL
“error”:null,“errorText”:null}]
Failure:
[{"status": "2","error":" IPAY0100124”,
“errorText”:” Problem occurred while validating transaction data”
“result”:null}]
1 status M Numeric If the request validation success, then status will be ‘1’. If
the validation failed, then status will be ‘2’
2 result M Alphanum It contains payment ID and Payment URL if the validation
success else this will be null
3 error C Alphanum If validation failed, then Payment gateway will provide the
respective error code
4 errorText C Alphanum If validation failed, then Payment gateway will provide the
respective error description
• Merchant needs to frame the payment page URL like the below sample
http://10.44.71.241:8080/FSSiPay3.3.0_AlRajhi_restAPI/paymentpage.htm?Paymen-
tID=100201931620827468&id=1234$ssdfg
• Merchant needs to redirects the customer to ARB Payment gateway.
Customer browser will redirect to ACS page and will complete the authentication. PG then process
for authorization with the respective schemes. Once payment response received from respective
scheme, then ARB Payment gateway returns the response to merchant. This is URL redirection.
Below is sample response from ARB PG to merchant,
Plain Trandata
[{“paymentId”:100201935044735860,”result”:”captured”,”amt”:10.55,”date”:1221,
”ref”:”935110000001”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”udf3text”,”udf4”:”
udf4text”,”udf5”:”udf5text”,”trackId”,”3423423”,”tran-
sId”:1242345345234,“authRespCode”:”00”,"authCode":"000000"}]
• For Non 3D Secure Purchase Transactions Merchant forwards the API request to ARB Payment gate-
way, below is sample request.
• Action Code for Purchase Transactions is 1
[{“amt”:”12.00”,”action”:”1”,”pass-
word”:”q@a68O$27@JLkcK”,”id”:”IPAYlCR6qZF7q6w”,”curren-
cyCode”:”682”,”trackId”:”123456”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”udf3te
xt”,”udf4”:”udf4text”,”udf5”:”udf5text” ,”expYear”:”2022”,”expMonth”:”12”,”mem-
ber”:”cardholdername”,”cvv2”:”212”,”cardNo”,”5453********5539”,”cardType”:”C",
"accountDetails":[{"bankIdCode": "12345d6f", "iBanNum":
"567896743281926354276254","serviceAmount":"200.00","valueDate":"20203112"
},{"bankIdCode": "1234ret3", "iBanNum": "987656743281926354276254","serviceA-
mount":"300.00","valueDate":"20213112" }]
}]
plain Trandata request for Credit Card Installment Transactions (udf6 and udf7 additional
parameters)
[{“amt”:”12.00”,”action”:”1”,”pass-
word”:”q@a68O$27@JLkcK”,”id”:”IPAYlCR6qZF7q6w”,”curren-
cyCode”:”682”,”trackId”:”123456”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”udf3te
xt”,”udf4”:”udf4text”,”udf5”:”udf5text”,"udf6":"12345","udf7","C",”expYear”:”2022”,
”expMonth”:”12”,”member”:”cardholder-
name”,”cvv2”:”212”,”cardNo”,”5453********5539”,”cardType”:”C",
"accountDetails":[{"bankIdCode": "12345d6f", "iBanNum":
"567896743281926354276254","serviceAmount":"200.00","valueDate":"20203112"
},{"bankIdCode": "1234ret3", "iBanNum": "987656743281926354276254","serviceA-
mount":"300.00","valueDate":"20213112" }]
}]
7 udf1 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned
in the transaction response. Merchant should ensure that
field is left blank when no data needs to be passed.
8 udf2 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned
in the transaction response. Merchant should ensure that
field is left blank when no data needs to be passed.
9 udf3 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned
in the transaction response. Merchant should ensure that
field is left blank when no data needs to be passed.
10 udf5 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned
in the transaction response. Merchant should ensure that
field is left blank when no data needs to be passed.
UDF 6 and UDF7 parameters should be passed only for Credit Card installment Transactions as be-
low:
18 udf6 O Alphanum Credit Card Installment Short Code
• Once ARB payment gateway verifies the transaction and returns the response to the same request.
[{“paymentId”:-1,”result”:”captured”,”amt”:10.55,”date”:1221,
”ref”:”935110000001”,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”udf3text”,”udf4”:”
udf4text”,”udf5”:”udf5text”,”trackId”,”3423423”,”tran-
sId”:1242345345234,“authRespCode”:”00”,"authCode":"000000"}]
• Inquiry Transactions :As an added security measure ARB Payment Gateway allows merchants to
do an inquiry of already completed transaction by passing certain details of the payment message,
ARB Payment Gateway provides response to this request with appropriate fields in the response;
the merchant is expected to verify the relevant fields like Transaction amount, transaction status
and other transaction fields.
• Refund Transactions : Merchant collects the cancellation request and initiate the transaction using
Refund API. Merchant may initiate refund for full amount or partial amount; Payment Gateway will
allow amount until it reached to original transaction amount.
• Action Code for Inquiry Transactions is 8
• Action code for void Transactions is 3
• Action code for refund Transactions is 2
[{"amt":"70.00","action":"<action code>","password":"q@a68O$27@JLkcK",
"id":"IPAYlCR6qZF7q6w","currencyCode":"682","trackId":"696921377",
"udf5":"TRANID","transId":"201931951332346"}]
Based on Payment ID (Payment ID):
[{"amt":"70.00","action":"<action code>","password":"q@a68O$27@JLkcK",
"id":"IPAYlCR6qZF7q6w","currencyCode":"682","trackId":"696921377","udf5":"Pay-
mentID","transId":"100201931948635783"}]
Based on TrackID (Merchant Transaction ID/Track ID):
[{"amt":"70.00","action":"<action code>","password":"q@a68O$27@JLkcK",
"id":"IPAYlCR6qZF7q6w","currencyCode":"682","trackId":"696921377",
"udf5":"TrackID","transId":"696921377"}]
Request from Merchant to ARB Payment Gateway
1 id M Alphanum Tranportal ID. Merchant can download the Tranportal id from Mer-
chant portal
2 trandata M Alphanum All the below request parameters encrypted and pass the encrypted
value in trandata.
• Once ARB payment gateway verifies the transaction and returns the response to the same request.
[{“paymentId”:100201934525118923,”result”:”suc-
cess”,”date”:1221,”udf1”:”udf1text”,”udf2”:”udf2text”,”udf3”:”udf3text”,”udf4”:”udf
4text”,”udf5”:”PaymentID”,”trackId”,”3423423”,”transId”:201931951332346,
”ref”:”935110000001”,”authRespCode”:”00”,"authCode":"000000"}]
1 trandata M AlphaNum All the below response parameters will be provided in trandata field
2 error C Alphanum If any error during processing, PG will provide the error code
3 errorText C Alphanum If any error during processing, PG will provide the error description
• For Apple Pay purchase Transactions Merchant forwards the API request to ARB Payment gateway
below is sample request.
• Action Code for Purchase Transactions is 1
[{"password":"OlE34@zAfcR5$2!","trackId":"466418734","udf5":"Select","payment-
Data":"<encrypted payment Data>","transactionIdenti-
fier":"93FEFF8B40ACB2FC46B3B48130A91E5E83BD7A1EFC0FAA3FA0F128BC755A0D9F","amt":"50.
00","action":"1","paymentMethod":"{\"displayName\":\"Visa 4228\",\"net-
work\":\"Visa\",\"type\":\"debit\"}","id":"IPAYN6dz0roK9DR","currencyCode":"SAR"}]
Request from Merchant to ARB payment gateway
7 udf1 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
8 udf2 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
9 udf3 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
10 udf5 O Alphanum The user (merchant) defines these fields. The field data is
passed along with a transaction request and then returned in
the transaction response. Merchant should ensure that field is
left blank when no data needs to be passed.
17 paymentData M Alphanum Payment Data(The encrypted payment credentials and associ-
ated cryptography information) for Apple Pay Transaction
18 payment- M Alphanum Payment Method (Ancillary information about the cardholder’s
Method card which was provisioned to the device)for Apple Pay Trans-
action
19 transactionIden- M Alphanum Transaction Identifier(Transaction id,generated on the device.)
tifier for Apple Pay Transaction
• Once ARB payment gateway verifies the transaction and returns the response to the same request.
[{"date":520,"trackId":"466418734","transId":202014168384115,"udf5":"Se-
lect","amt":"50.0","udf3":"null","udf4":"null","udf1":"null","udf2":"null","re-
sult":"CAPTURED","authRespcode":"00","ref":"014136000005","paymentId":-1,
"authCode":"000000"}]
Response from ARB Payment Gateway to Merchant
1 trandata M AlphaNum All the below response parameters will be provided in trandata field
2 error C Alphanum If any error during processing, PG will provide the error code
3 errorText C Alphanum If any error during processing, PG will provide the error description
1. Customer visits the merchant site and selects the merchandise and confirms to pay using the pay-
ment gateway.
2. Merchant redirects the customer with the Invoice transaction data to the payment gateway.
3. Payment Gateway verifies the invoice transaction request from the merchant and generates the
invoice Payment URL based on the invoice type.
4. Payment gateway will provide the response to merchant with invoice Payment URL.
5. Merchant to redirect the Payment URL to Payment Gateway.
6. There are two types of invoice transactions namely Dedicated and Open invoice.
7. If the initiated transaction type is dedicated, Merchant need to send the buyer details in the request.
8. PG presents the hosted payment page with buyer details to customer and prompts the customer to
enter the card credentials.
9. If the initiated transaction type is open then merchant no need to send buyer details.
10. Payment gateway will get the buyer detail and process the transaction with the respective schemes.
11. Once the transaction complete, PG will send the response to merchant and customer via mail &
SMS.
• Trandata will contain below parameters encrypted with AES algorithm with CBC Mode, PKCS5Pad-
ding with initialization vector value PGKEYENCDECIVSPC under Resource Key
[{"password":"1lY@q4Ln7@$DI7x","mobile":"9952919578","amt":"100.00","invoice-
Type":"D","invoiceId":"123456789","id":"IPAYPP9ckEq57Fh","itemDesc":"Watch","buy-
erName":"Alex","currencyCode":"682","email":[email protected],"expiryDate":"15-05-
2020 16:14:18"}]
[{"password":"1lY@q4Ln7@$DI7x","amt":"100.00","invoiceType":"O","in-
voiceId":"123456789","id":"IPAYPP9ckEq57Fh","itemDesc":"Watch","curren-
cyCode":"682","expiryDate":"15-05-2020 16:14:18"}]
Request from Merchant to ARB Payment gateway
All the below request parameters encrypted and pass the en-
2 trandata M Alphanum
crypted value in trandata.
Field
S. No Fields M/C/O Description
Type
5
itemDesc M Alphanum 500-digit Item Description.
Alpha-
6 buyerName M 50-digit Buyer Name.
betic
Field
S. No Fields M/C/O Description
Type
Field
S. No Fields M/C/O Description
Type
5
itemDesc M Alphanum 500-digit Item Description
• ARB Payment gateway internally validates the request and gives invoice payment page URL in the
response in case of successful validation, if failure then error code and description will be provided.
The below response will be in plain format and there is no encryption for the below. Merchant can
directly parse the response-based on the status and result fields as mentioned below.
Success:
[{"status": "1", "result":
"https://securepayments.alrajhibank.com.sa/mrchptl/iP.htm?Id=Y3FT9" //Invoice Pay-
ment Page URL}]
Failure:
[{"status": "2","error":" IPAY0100124”,
“errorText”:” Problem occurred while validating transaction data”}]
Initial Response from PG to Merchant for Dedicated and Open Invoice
1 status M Numeric If the request validation success, then status will be ‘1’. If the valida-
tion failed, then status will be ‘2’
2 result C Alphanum It contains invoice Payment URL if the validation success
3 error C Alphanum If validation failed, then Payment gateway will provide the respective
error code
4 error- C Alphanum If validation failed, then Payment gateway will provide the respective
Text error description
• If success, Merchant needs to redirect the invoice payment page URL like the below sample
https://securepayments.alrajhibank.com.sa/mrchptl/iP.htm?Id=Y3FT9
• Once merchant redirects the link, ARB Payment Gateway shows the invoice Payment Page to cus-
tomer based on the invoice type.
• After validating the customer card details then ARB Payment gateway will provide the final response
to merchant and customer via mail & SMS.
1. Payment gateway will initiate REST call to send the transaction status notification request to
merchant and wait for the acknowledgement.
2. If PG receives the acknowledgment from merchant, then Payment Gateway logs the response
and provides the transaction update to Cortex system for processing the settlement and Pay-
ment Gateway sends the final response to merchant. The final response will be URL redirection.
3. Merchant displays transaction result to customer.
4. In case, if PG does not receive the acknowledgment from merchant then PG will initiate the
VOID transaction to respective scheme to reverse the transaction and there is no payment
advise initiated to Cortex.
1. Payment Gateway logs the response and provides the transaction update to Cortex system for
processing the settlement and Payment Gateway sends final response to merchant and this will
be URL redirection.
2. Merchant displays transaction result to customer.
[{“paymentId”:100201935044735860,“trandata”:”<encrypted trandata>”,}]
Plain Trandata:
[{“paymentId”:100201935166676976,”result”:”CAPTURED”,”ref”:”935110000001”,”tran-
sId”:201935166561122,date:1217,”trackId”:”1003383844”,”udf1”:””,”udf2”:””,”udf3”:”8
870091137”,”udf4”:”FC”,”udf5”:”Tidal5”,”amt”:”70.0,”authRespCode”,”00”,"authCode":"
000000"}]
Notification request from PG to Merchant
1 paymentId M Numeric Unique ID generated by Payment gateway. Merchant can store the
payment ID to match the final URL redirection response
2 trandata M Alphanum All the below response parameters encrypted and send the en-
crypted value in trandata
The user (merchant) defines these fields. The field data is passed
along with a transaction request and then returned in the transac-
7 udf1 O Alphanum
tion response. Merchant should ensure that field is left blank when
no data needs to be passed.
The user (merchant) defines these fields. The field data is passed
along with a transaction request and then returned in the transac-
8 udf2 O Alphanum
tion response. Merchant should ensure that field is left blank when
no data needs to be passed.
The user (merchant) defines these fields. The field data is passed
along with a transaction request and then returned in the transac-
9 udf3 O Alphanum
tion response. Merchant should ensure that field is left blank when
no data needs to be passed.
The user (merchant) defines these fields. The field data is passed
along with a transaction request and then returned in the transac-
10 udf5 O Alphanum
tion response. Merchant should ensure that field is left blank when
no data needs to be passed.
authRespCo
12 M Numeric Auth response code provided by PG
de
2 result M Alphanum Merchant response URL for which PG will provide the final URL redirection
response
• If ARB payment gateway receives the acknowledgement from merchant, PG logs the response and
provide the response back to merchant. This will be URL redirection.
[{“paymentId”:”100201935166676976”,“trandata”:”<encrypted trandata>”,
“Error”:””,“ErrorText”:””}]
Plain Trandata:
[{“paymentId”:100201935166676976,”result”:”CAPTURED”,”ref”:”935110000001”,”tran-
sId”:201935166561122,”date”:1217,”trackId”:”1003383844”,”udf1”:””,”udf2”:””,”udf3”:
”8870091137”,”udf4”:”FC”,”udf5”:”Tidal5”,”amt”:”70.0,”authRespCode”,”00”,"authCode"
:"000000"}]
• If there is no acknowledgement from Merchant After initiating the merchant notification, PG will wait
for the response based on the configured time and no acknowledgement from merchant then PG
will void the transaction and update the response back to merchant error URL received in the initial
API request.
[{“paymentId”:100201935166676976,”Result”:”Voided”,”error”:”IPAY0200025”,”error-
Text”:”!ERROR!-IPAY0200025 - Problem occurred while getting merchant acknowledge-
ment & transaction reversed”,”trackId”:”123456”,”amt”:”12.0”}]
o If Merchant has REST Flag enabled and key type chosen as two, terminal resource key 2 is
generated for all the terminals created for the merchant.
o Merchant shall encrypt the REST API request to Payment Gateway using the terminal re-source
key 1
o Payment Gateway will decrypt the REST API request from merchant using the default terminal
resource key 1
o The terminal Resource key 2 is used to encrypt the final REST API final response from Payment
Gateway to merchant.
o Merchant needs to decrypt the Rest API final response from Payment Gateway using this Re-
source key 2.
o If Merchant has Rest Flag enabled and Response type chosen as 'GET' , The response type of
REST API final response from payment Gateway to Merchant is GET .
o If Merchant has Rest Flag enabled and Response type chosen as 'POST' , The response type of
REST API final response from payment Gateway to Merchant is POST .
Ans. 1. Tranportal ID
2. Tranportal Password
3. Resource Key
Q2.Where to get tranportal ID , Password , Resource key and end point Url's?
Ans. Tranportal Id , Password , Resource Key and end point URL's will be shared to the merchant
via mail to their registered E-mail Id.
Ans. Resource key is unique for a terminal . It is required for encryption of request parameters
and decryption of response paramters while connecting to ARB Payment Gateway. Bank
user will share the resource key in a secured manner.
Ans. ARB Payment Gateway allows merchants to do an inquiry of already completed transaction
by passing certain details of the payment message, ARB Payment Gateway provides re-
sponse to this request with appropriate fields in the response; merchant is expected to
verify the relevant fields like Transaction amount, transaction status and other transaction
fields.
Q5. What are the action codes for inquiry ,refunds and Void transactions?
Action Codes
Purchase 1
Refund 2
Inquiry 8
Void 3
Q6. Based on what parameters can transactions be inquired?
Ans. Transactions can be inquired based on transaction ID , Payment ID and Track ID of original
transaction.
Ans. After the integration testing, transactions can be verified on merchant Portal
To verify if a transaction has been settled or not merchant can always refer the transaction
detail report in merchant Portal . Navigation to transaction detail report in merchant
portal is as below :
Ans.
Result Description
Byte [] textDecrypted=null;
Try {
Byte [] b = hexStringToByteArray(encryptedString);
skeySpec = new SecretKeySpec(key.getBytes("UTF-8"),"AES");
ivspec = new IvParameterSpec(AES_IV.getBytes("UTF-8"));
cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, skeySpec,ivspec);
textDecrypted = cipher.doFinal(b);
} catch (Exception e) {
e.printStackTrace();
}
finally
{
skeySpec=null;
ivspec=null;
cipher =null;
}
return(new String(textDecrypted));
}
Note: After decrypting encryptedString value. Merchant needs to decode the textDecrypted value
with URL Decoder.
function aesEncrypt(trandata,key)
{
var iv = "PGKEYENCDECIVSPC";
var rkEncryptionIv = aesjs.utils.utf8.toBytes(iv);
var enckey= aesjs.utils.utf8.toBytes(key);
var aesCtr = new aesjs.ModeOfOperation.cbc(enckey, rkEncryptionIv);
var textBytes = aesjs.utils.utf8.toBytes(trandata);
var encryptedBytes = aesCtr.encrypt(aesjs.padding.pkcs7.pad(text Bytes));
var encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes);
return encryptedHex;
}
Note: Before encrypting trandata value. merchant needs to encode the value with URL
Encoder.
function AESdecryption(encryptedHex,key)
{
var iv = "PGKEYENCDECIVSPC";
var enckey= aesjs.utils.utf8.toBytes(key);
var rkEncryptionIv = aesjs.utils.utf8.toBytes(iv);
var encryptedBytes = aesjs.utils.hex.toBytes(encryptedHex);
var aesCbc = new aesjs.ModeOfOperation.cbc(enckey, rkEncryptionIv);
var decryptedBytes = aesCbc.decrypt(encryptedBytes);
var decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes);
return decryptedText;
}
Note: After decrypting encryptedHex value. Merchant needs to decode the decryptedText value
with URL Decoder.
Encryption:
function encryptAES($str,$key)
{
$str = $this->pkcs5_pad($str);
$ivlen = openssl_cipher_iv_length($cipher="aes-256-cbc");
$iv="PGKEYENCDECIVSPC";
$encrypted = openssl_encrypt($str, "aes-256-cbc",$key, OPENSSL_ZERO_PADDING, $iv);
$encrypted = base64_decode($encrypted);
$encrypted = unpack('C*', ($encrypted));
$encrypted=$this->byteArray2Hex($encrypted);
$encrypted = urlencode($encrypted);
return $encrypted;
}
Note: Before encrypting transaction data, data needs to be encoded using URL-Encoder
Decryption:
Chapter 4 TROUBLESHOOTING
The following table contains the known error codes and their descriptions:
IPAY0100136 Transaction denied due to previous capture check failure (Validate Original Transac-
tion)
IPAY0100138 Transaction denied due to capture amount versus auth amount check failure (Vali-
date Original
IPAY0100139 Transaction denied due to void amount versus original amount check failure (Vali-
date Original
IPAY0100140 Transaction denied due to previous void check failure (Validate Original Transaction)
IPAY0100141 Transaction denied due to authorization already captured (Validate Original Transac-
tion)
IPAY0100142 Problem occurred while validating original transaction
IPAY0200030 No external connection details for Extr Conn id :
IPAY0200031 Alternate external connection details not found for the alt Extr Conn id :
IPAY0100143 Transaction action is null
IPAY0100144 ISO MSG is null. See log for more details!
IPAY0100145 Problem occurred while loading default messages in ISO Formatter
IPAY0100147 Problem occurred while formatting purchase request in B24 ISO Message Formatter
IPAY0100150 Problem occurred while formatting Reverse purchase request in B24 ISO Message
Formatter
IPAY0100152 Problem occurred while formatting authorization request in B24 ISO Message For-
matter
IPAY0100153 Problem occurred while formatting Capture request in B24 ISO Message Formatter
IPAY0100155 Problem occurred while formatting reverse authorization request in B24 ISO Mes-
sage Formatter
IPAY0100156 Problem occurred while formatting Reverse Capture request in B24 ISO Message
Formatter
IPAY0100159 External message system error
IPAY0100160 Unable to process the transaction.
IPAY0100163 Problem occurred during transaction.
IPAY0100166 Transaction Not Processed due to Empty Authentication Status
IPAY0100167 Transaction Not Processed due to Invalid Authentication Status
IPAY0100168 Transaction Not Processed due to Empty Enrollment Status
IPAY0100169 Transaction Not Processed due to Invalid Enrollment Status
IPAY0100170 Transaction Not Processed due to invalid CAVV
IPAY0100171 Transaction Not Processed due to Empty CAVV
IPAY0100172 Problem occurred while converting amount.
IPAY0100173 Problem occurred while building refund request.
▪ By decrypting trandata Merchant can able to get the JSON Response. JSON response con-
tains all the required data.
▪ If trandata is null or empty, then merchant needs to do follow below step to get response
fields from Payment Gateway.
▪ To get Transaction Id: request.getParameter("tranid") this value can be null or empty
▪ To get Payment Id: request.getParameter("paymentid") this value can be null or empty
▪ To get Error Description: request.getParameter("ErrorText")
▪ To get Error Code: request.getParameter("Error")