0% found this document useful (0 votes)
20 views20 pages

JCB QR Cross Border Payments - C# Sample Code Guide - v2.1

The document is a user guide for the JCB QR Cross Border Payment sample code in C#, detailing the technical specifications and components necessary for integration. It includes sections on API specifications, sample code for both issuer and acquirer transactions, and confidentiality statements. The guide is intended for licensees looking to connect to the JCB QR Payment solution and provides essential information for onboarding and implementation.

Uploaded by

mainframeliu
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
0% found this document useful (0 votes)
20 views20 pages

JCB QR Cross Border Payments - C# Sample Code Guide - v2.1

The document is a user guide for the JCB QR Cross Border Payment sample code in C#, detailing the technical specifications and components necessary for integration. It includes sections on API specifications, sample code for both issuer and acquirer transactions, and confidentiality statements. The guide is intended for licensees looking to connect to the JCB QR Payment solution and provides essential information for onboarding and implementation.

Uploaded by

mainframeliu
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
You are on page 1/ 20

JCB QR Cross Border Payment

Sample Code User Guide for C#

11th December 2019

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 0


STATEMENT OF CONFIDENTIALITY
The information contained in or supplied with this document, in its entirety, is the confidential and
proprietary information of JCB, and it may not be copied by or disclosed to any person or entity (other
than to the intended recipient), without the prior written consent of JCB. With or without JCB prior
written consent, JCB accepts no liability whatsoever for any consequences arising from the reproduction
of the information contained in or supplied with this document, or from its disclosure to any person or
entity, including to the intended recipient. The intended recipient shall not use any part of the information
contained in, or supplied with this document, in any way to the competitive disadvantage of JCB, and will
take all steps designed to assure its compliance with this provision.

TRADEMARKS

All other trademarks are the property of their owners.

Company, product, and service names used by JCB Inc. within or supplied with this document may be
trademarks or service marks of other persons or entities.

COPYRIGHT

Copyright 2019 JCB Co., Ltd.

All Rights Reserved.

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 1


TABLE OF CONTENTS

1 INTRODUCTION ............................................................................................................................................. 3

2 COMPONENTS ............................................................................................................................................... 3

3 INTERFACE ..................................................................................................................................................... 3

4 TECHNOLOGY SUPPORT ................................................................................................................................ 3

5 COMMON SAMPLE CODE .............................................................................................................................. 3

5.1 ISSUER CODE: ...................................................................................................................................................3


5.2 ACQUIRER CODE: ..............................................................................................................................................4

6 API SPECIFICATIONS ...................................................................................................................................... 5

6.1 PAYMENT REQUEST “PAYREQ”.............................................................................................................................7


6.2 PAYMENT RESPONSE “PAYRES” ............................................................................................................................8
6.3 PAYMENT REVERSAL REQUEST “PAYREVREQ” .......................................................................................................10
6.4 PAYMENT REVERSAL RESPONSE “PAYREVRESP” .....................................................................................................12
6.5 PAYMENT TIMEOUT REVERSAL REQUEST “PAYTIMEOUTREVREQ” ..............................................................................13
6.6 REJECT NOTIFY REQUEST “PAYREJECTNOTIFY” ......................................................................................................14
6.7 REJECT REVERSAL “REJREVERSAL”.......................................................................................................................15
6.8 TRANSACTION STATUS REQUEST “TXNSTATUS”: .....................................................................................................16
6.9 EXCHANGE RATE REQUEST “EXRATE”: ..................................................................................................................17

7 ANNEXURE .................................................................................................................................................. 19

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 2


1 Introduction
The purpose of this document is to brief the user about the C# technical details in JCB QR Payment
solution. This document embraces about C# Sample code, overview and specifications.

This document provides the clear explanation about the technical details and specifications to user. This
shall be distributed to Licensees those who are willing to connect to JCB QR Payment solution and it will
help them in onboarding.

2 Components
JCB sample code shall consist of major components. which are listed as below

• Sample code
• Readme.html

3 Interface
Common sample code provides an interface to JCB QR applications for both Issuer & Acquirer transactions
that can be performed between banks. Integration methodology and flow would differ depending upon
the programming platform. Interface details shall be elaborated as below.

4 Technology support
As of now we shall support C# 4.5 or higher to it only.

5 Common Sample Code


This section is to give an understanding on the sample code for the both Issuer and acquirer in the JCB QR
Payment solution. Below is the detail description with the sample code for both parties.

5.1 Issuer Code:


Issuer is the originating system in the JCB QR Payment, where the transaction will be routed to JCB once
the debit is successful from the customer’s account where the transaction will be landed in JCB space.

Below APIs will be consumed by the issuer to initiate the transaction and at the same time issuer also has
to provide the response for some transactions.

When Issuer is initiating the transaction, it will be treated as the CLIENT and when Issuer has to send the
response back to the request means issuer will act as a SERVER. There are different APIs which are
involved in this process.

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 3


APIs consumed by Issuer as CLIENT:

Class Method HTTP request Description

PayreqcontrollerApi payReqUsingPOST POST/gateway/api/{licenseeid}/v1.0/payreq payreq

PayrevrescontrollerApi payRevResUsingPOST POST/gateway/api/{licenseeId}/v1.0/payrevresp payrevresp

TxnstatuscontrollerApi txnStatusUsingPOST POST/gateway/api/{licenseeId}/v1.0/txnstatus txnStatus

ExRate API exrateUsingPOST POST /gateway/api/{licenseeId}/v1.0/exrate exrate

APIs consumed by Issuer as SERVER:

Class Method HTTP request Description


POST/gateway/api/{licenseeId}/v1.0/
PayresControllerApi payres
payResUsingPOST payres
RevReqControllerApiExa POST/gateway/api/{licenseeId}/v1.0/
payrevreq
mple payRevReqUsingPOST payrevreq

In detail explanation for each API is taken care in next section.

5.2 Acquirer Code:


Acquirer is the system where the transaction will be ended by crediting in to the merchant’s account and
respond back to merchant and JCB with the response.

Below APIs will be consumed by the acquirer to respond with the transaction status and in sometimes
acquirer also has to request for reversals for some exception cases.

When acquirer is initiating the reversal transaction or responding to the original request it will be treated
as the CLIENT and when Acquirer has to send the response back tie the request Acquirer will act as a
SERVER. There are different APIs which are involved in this process.

APIs consumed by Acquirer as CLIENT:

Class Method HTTP request Description


PayrevreqcontrollerApi payRevReqUsingPOST POST /gateway/api/{licenseeId}/v1.0/payrevreq payRevReq
PayrescontrollerApi payResUsingPOST POST/gateway/api/{licenseeId}/v1.0/payres payRes
TxnstatuscontrollerApi txnStatusUsingPOST POST /gateway/api/{licenseeId}/v1.0/txnstatus txnStatus
ExRate API exrateUsingPOST POST /gateway/api/{licenseeId}/v1.0/exrate exrate

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 4


APIs consumed by Issuer as SERVER:
Class Method HTTP request Description
POST/gateway/api/{licenseeId}/
PayreqcontrollerApi payReqUsingPOST v1.0/payreq payreq
POST/gateway/api/{licenseeId}/
PayrevrescontrollerApi payRevResUsingPOST v1.0/payrevresp payrevresp
POST/gateway/api/{licenseeId}/
PaytimeoutrevcontrollerApi payTimeoutRevReqUsingPOST v1.0/paytimeoutrevreq paytimeoutrevreq
POST/gateway/api/{licenseeId}/
RejectNotifyControllerApi payRejectNotifyReqUsingPOST v1.0/ payrejectnotify payrejectnotify
POST/gateway/api/{licenseeId}/
PayrejectrevcontrollerApi payRejectRevReqUsingPOST v1.0/rejreversal rejreversal

In detail explanation for each API is taken care in next section.

6 API Specifications
All the APIs for JCB QR Payment supports HTTP version 1.1, and HTTP method for all APIs is POST.
All API URLs follow the below format:
<Scheme>://<Host:Port>/<contextRoot>/api/<licensee_identifier>/<Version>/<apiName>

(1) URL format when Licensee sends API to JCBI

Example URL: https:// qrcode.jcbglobal.com:443/ gateway/api/LIC/v1.0/payreq

URL elements are explained in detailed below.

URL Element Definition Sample

Scheme Fixed value https

Host:Port Hostname and port number of JCBI. The value shall be different qrcode.jcbgloba
based on environment. l.com:443

<Sandbox> - sbox.qrcode.jcbglobal.com:443

<Certification> - cert.qrcode.jcbglobal.com:443

<Production> - qrcode.jcbglobal.com:443

contextRoot Context root of the services. The value shall be different based gateway
on environment

<Sandbox> - gateway

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 5


<Certification> - gateway

<Production> - gateway

Api Fixed value api

licensee_identifier A three-digit alphabetical code which will be provided at the LIC


boarding for each Licensee.

Version The version of API. Both of major and minor versions shall be set. v1.0

API Name Name of the API URL endpoint. Types of API defined as follows: Payreq

Payment Request: “payreq”


Payment Response: “payres”
Reversal Request: “payrevreq”
Reversal Response: “payrevresp”
Reject Notify Request:”payrejectnotify”
Transaction Status inquiry Request: “txnstatus”
Exchange Rate Lookup Request: “exrate”

(2) URL format when JCBI sends API to Licensee

Example URL: https:// XXXXX.XXX: 443 /gateway/api/LIC/v1.0/payreq

URL elements are explained in detailed below.

URL Element Definition Sample

Scheme Fixed value https

Host:Port Hostname and port number of Licensee. The value shall be XXXXX.XXX: 443
submitted to JCBI in advance using Form A.

contextRoot Context root of the services. The value shall be submitted to gateway
JCBI in advance using Form A.

Api Fixed value api

licensee_identifier A three-digit alphabetical code which will be provided at the LIC


boarding for each Licensee.

Version The version of API. Both of major and minor versions shall be v1.0
set.

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 6


API Name Name of the API URL endpoint. Types of API defined as Payreq
follows:

Payment Request: “payreq”


Payment Response: “payres”
Reversal Request: “payrevreq”
Reversal Response: “payrevresp”
Time out Reversal Request : “paytimeoutrevreq”
Reject Reversal Request : “rejreversal”
Reject Notify Request : "payrejectnotify"

Sample code for the different APIs are as follows:

6.1 Payment Request “payreq”


Payreq is asynchronous API which shall be used to initiate the transaction from the ISSUER.

Request Format: POST/gateway/api/{licenseeId}/v1.0/payreq

Sample Code Snippet

/*
* URL Pattern -- > /gateway/api/{licenseeId}/v1.0/payreq
* Request Method -- > POST
* Request Header -- > APIUniqueID , MessageID , TimeStamp , Version
* Path variable -- > licenseeId
* String licenseeId = "licenseeId"; // String | licenseeId - pass the same id which was
received in payreq pathVariable
* String aPIUniqueID = "ApiUniqueId"; // String | APIUniqueID - pass the same id which
was received in payreq requestHeader
* String messageID = "MessageID"; // String | MessageID - pass the same id which was
received in payreq requestHeader
* String timeStamp = "TimeStamp"; // String | TimeStamp - pass the same time stamp
which was received in payreq requestHeader
* String version = "Version"; // String | Version - pass the same version which was
received in payreq requestHeader
* Request Body -- > PaymentRequest
* @return Ack
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the
response body
*/

public IHttpActionResult Payreq([FromBody] payreq mData)


{
try
{
string issRefNo = mData.IssuerReferenceNumber;

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 7


Ack.Add(new ack() { IssuerReferenceNumber =
createAck(issRefNo) });
return Ok(Ack);
}
catch (Exception ex)
{
return BadRequest();
}
}

Input Parameters:

Name Type Description


aPIUniqueID String APIUniqueID
messageID String MessageID
timestamp String Time Stamp
version String Version
request PaymentRequest Request
licenseeId String Licensee ID

Return Type: Ack

Name Type Description


issuerReferenceNumber String Issuer Reference Number

6.2 Payment Response “payres”


Payres is an asynchronous API which shall be used for sending back the response of initiated through
ReqPay API.

Request Format: POST /gateway/api/{licenseeId}/v1.0/ payres

Sample Code Snippet

// Import classes:
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

static void Main(string[] args)


{
CallWebAPIAsync().Wait();
}

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 8


static async Task CallWebAPIAsync()
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:55587/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("APIUniqueID", "JCB2345");
client.DefaultRequestHeaders.Add("MessageID", "20010");
client.DefaultRequestHeaders.Add("TimeStamp", "Tue, 24 Jul 2018 08:49:37
GMT");
client.DefaultRequestHeaders.Add("Version", "v1.0");
client.DefaultRequestHeaders.Add("UserAuthKey", "1234");

//POST Method

var PayReq = new payreq() { };


HttpResponseMessage responsePost = await
client.PostAsJsonAsync("v1.0/payres", PayReq);
if (responsePost.IsSuccessStatusCode)
{
// Get the URI of the created resource.
Uri returnUrl = responsePost.Headers.Location;
Console.WriteLine(returnUrl);
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("Success : " + resp);
}
else
{
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("{0} ({1})", (int)responsePost.StatusCode,
responsePost.ReasonPhrase);
Console.WriteLine("Error : " + resp);
}
}
Console.Read();
}

Input Parameters:

Name Type Description


Head Header API Header parameters
Response Payment Response Response
contextPath String Context Path

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 9


Return Type: Acknowledgement with below properties.

Name Type Description


issuerReferenceNumber String Issuer Reference Number

6.3 Payment Reversal Request “payrevreq”


This API shall be used for raising the reversal for the original Payreq in any time out scenario.

Request Format: POST /gateway/api/{licenseeId}/v1.0/payrevreq

Sample Code snippet:

// Import classes:
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

static void Main(string[] args)


{
CallWebAPIAsync().Wait();
}

static async Task CallWebAPIAsync()


{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:55587/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("APIUniqueID", "JCB2345");
client.DefaultRequestHeaders.Add("MessageID", "20010");
client.DefaultRequestHeaders.Add("TimeStamp", "Tue, 24 Jul 2018 08:49:37 GMT");
client.DefaultRequestHeaders.Add("Version", "v1.0");
client.DefaultRequestHeaders.Add("UserAuthKey", "1234");

//POST Method

var PayReq = new payreq() { AcquirerInstitutionIdentificationCode = "88005000",


AcquirerPrivateData = "string",
AmountCardmemberBilling= "112.00",
AmountSettlementAcquirer = "112.00",
AmountSettlementIssuer = "112.00",
AmountTransaction = "112.00",
AuthorizationId = "21324K",
BillNumber = "123456789BB",
BusinessApplicationID = "MP",
CardAcceptorCity = "Ho Chi Minh",
CardAcceptorCountry = "VND",

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 10


CardAcceptorName = "Piers Cafe",
CardmemberName = "John Smith",
ConversionDateSettlementAcquirer = "1005",
ConversionDateSettlementIssuer = "1005",
ConversionRateCardmemberBilling = "00001.00",
ConversionRateSettlementAcquirer = "0012.34",
ConversionRateSettlementIssuer = "0012.34",
CurrencyCodeCardmemberBilling = "704",
CurrencyCodeSettlementAcquirer = "704",
CurrencyCodeSettlementIssuer = "704",
CurrencyCodeTransaction = "704",
DateTimeGMTTransaction = "2018-08-06T13:42:00Z",
ForwardingInstitutionIdentificationCode = "33123456",
FundingSource = "02",
IssuerCountryCode = "VND",
IssuerInstitutionIdentificationCode = "12345678",
IssuerPrefix = "35301234",
IssuerReferenceNumber = "0110000000000000000000214",
LoyaltyNumber = "123456789LL",
MerchantID = "331234567890123",
MerchantPAN = "3312345678901234",
MerchantType = "5999",
PointOfServiceEntryMode = "0010",
PrimaryAccountNumber = "3530123456789018",
QRProcessingInformationIssuer = "21110000",
ResponseCode = "00",
RetrievalReferenceNumber = "827407000004",
SystemTraceAuditNumber = "111006",
TerminalID = "12345678"

};
HttpResponseMessage responsePost = await client.PostAsJsonAsync("v1.0/payrevreq",
PayReq);
if (responsePost.IsSuccessStatusCode)
{
// Get the URI of the created resource.
Uri returnUrl = responsePost.Headers.Location;
Console.WriteLine(returnUrl);
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("Success : " + resp);
}
else
{
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("{0} ({1})", (int)responsePost.StatusCode, responsePost.ReasonPhrase);
Console.WriteLine("Error : " + resp);
}
}
Console.Read();
}

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 11


Input Parameters:

Name Type Description


Head Header API Header parameters
Response Payment Response Response
contextPath String Context Path

Return Type: Acknowledgement with below properties.

Name Type Description


IssuerReferenceNumber String Issuer Reference Number

6.4 Payment Reversal Response “payrevresp”

This API is used for the sending back the response for the reversal request.

Request Format: POST /gateway/api/{licenseeId}/v1.0/payrevresp

Sample Code Snippet

/*
* URL Pattern -- > /gateway/api/{licenseeId}/v1.0/payrevresp
* Request Method -- > POST
* Request Header -- > APIUniqueID , MessageID , TimeStamp , Version
* Path variable -- > licenseeId
* Request Body -- > ReversalResponse
* @return Ack
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response
body
*/

public async Task payrevresp([FromBody] payrevresp mData)


{
try
{
string issRefNo = mData.IssuerReferenceNumber;
Ack.Add(new ack() { IssuerReferenceNumber =
createAck(issRefNo) });
return await Task.FromResult(Ok(Ack));
}
catch (exception ex)
{
return await Task.FromResult(BadRequest());
}
}

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 12


Input Parameters:

Name Type Description


aPIUniqueID String APIUniqueID
messageID String MessageID
timestamp String Time Stamp
version String Version
response ReversalResponse response
licenseeId String Licensee ID

Return Type: Acknowledgement with below parameters

Name Type Description


issuerReferenceNumber String Issuer Reference Number

6.5 Payment timeout reversal Request “paytimeoutrevreq”


This API is used to raise a request for a timeout of the payment reversal request.

Request Format: POST /gateway/api/{licenseeId}/v1.0/paytimeoutrevreq

Sample Code Snippet:


/*
* URL Pattern -- > /gateway/api/{licenseeId}/v1.0/paytimeoutrevreq
* Request Method -- > POST
* Request Header -- > APIUniqueID , MessageID , TimeStamp , Version
* Request Body -- > TxnVo
* @return ReversalResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response
body
*/

public Task<ReversalResponse> payTimeoutRevReq([FromBody] TxnVo mData)


{
try
{
ReversalResponse revRes = new ReversalResponse();
return await Task.FromResult(revRes);
}
catch (Exception ex)
{
return BadRequest();
}
}

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 13


Input Parameters:

Name Type Description


aPIUniqueID String API Header parameters
messageID String Message ID
timeStamp String timeStamp
Version String Version
userAuthKey String Users Auth Key (It will be provided at customer onboarding)
Request Reversal Request request
licenseeId String Licensee Id

Return Type: Reversal Response with all Parameters.

6.6 Reject Notify Request “payrejectnotify”


This API is called when the transaction is getting rejected.

Request Format: POST /gateway/api/{licenseeId}/v1.0/payrejectnotify

Sample Code snippet:


/*
* URL Pattern -- > /gateway/api/{licenseeId}/v1.0/payrejectnotify
* Request Method -- > POST
* Request Header -- > APIUniqueID , MessageID , TimeStamp , Version
* Request Body -- > RejectNotifyVo
* @return RejectNotifyVo
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response
body
*/

public IHttpActionResult payRejectNotifReq([FromBody] RejectNotifyVo mData)


{
try
{
var rejectNotif = new rejectNotif();
return rejectNotif;
}
Catch (Exception ex)
{
return BadRequest();
}
}

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 14


Input Parameters:

Name Type Description


aPIUniqueID String API Header parameters
messageID String Message ID
timeStamp String timeStamp
Version String Version
Request RejectNotifyVO request
licenseeId String Licensee Id

Return Type: RejectNotifyVO with all Parameters.

6.7 Reject Reversal “rejreversal”


This is API shall be used to reject the reversal request.

Request Format: POST /gateway/api/{licenseeId}/v1.0/rejreversal

Sample Code Snippet:

/*
* URL Pattern -- > /gateway/api/{licenseeId}/v1.0/rejreversal
* Request Method -- > POST
* Request Header -- > APIUniqueID , MessageID , TimeStamp , Version
* Request Body -- > TxnVo
* @return ReversalResponse
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response
body
*/

public IHttpActionResult payRejectRevReq([FromBody] TxnVo mData)


{
try
{
ReversalResponse revRes = new ReversalResponse();
return revRes;
}
Catch (exception ex)
{
return BadRequest();
}
}

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 15


Input Parameters:

Name Type Description


aPIUniqueID String API Header parameters
messageID String Message ID
timeStamp String timeStamp
Version String Version
Request Reversal Request request
licenseeId String Licensee Id

Return Type: Reversal response with all Parameters.

6.8 Transaction status request “txnstatus”:

This is API shall be used to get the transaction status.

Request Format: POST /gateway/api/{licenseeId}/v1.0/txnstatus

Sample Code Snippet:

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

static void Main(string[] args)


{
CallWebAPIAsync().Wait();
}

static async Task CallWebAPIAsync()


{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:55587/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("APIUniqueID", "JCB2345");
client.DefaultRequestHeaders.Add("MessageID", "20010");
client.DefaultRequestHeaders.Add("TimeStamp", "Tue, 24 Jul 2018 08:49:37 GMT");
client.DefaultRequestHeaders.Add("Version", "v1.0");
client.DefaultRequestHeaders.Add("UserAuthKey", "1234");

//POST Method

var PayReq = new payreq() { };

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 16


HttpResponseMessage responsePost = await client.PostAsJsonAsync("v1.0/payres",
PayReq);
if (responsePost.IsSuccessStatusCode)
{
// Get the URI of the created resource.
Uri returnUrl = responsePost.Headers.Location;
Console.WriteLine(returnUrl);
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("Success : " + resp);
}
else
{
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("{0} ({1})", (int)responsePost.StatusCode, responsePost.ReasonPhrase);
Console.WriteLine("Error : " + resp);
}
}
Console.Read();
}

Input Parameters:

Name Type Description


Head Header API Header parameters
Request TxnStatusRequest Request
ContextPath String context Path

Return Type: transaction status Response with all the parameters.

6.9 Exchange rate request “exrate”:

This is API shall be used to get the exchange rate details.

Request Format: POST /gateway/api/{licenseeId}/v1.0/exrate

Sample Code Snippet:

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

static void Main(string[] args)


{
CallWebAPIAsync().Wait();

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 17


}

static async Task CallWebAPIAsync()


{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:55587/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new
MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("APIUniqueID", "JCB2345");
client.DefaultRequestHeaders.Add("MessageID", "20010");
client.DefaultRequestHeaders.Add("TimeStamp", "Tue, 24 Jul 2018 08:49:37 GMT");
client.DefaultRequestHeaders.Add("Version", "v1.0");
client.DefaultRequestHeaders.Add("UserAuthKey", "1234");

//POST Method

client.DefaultRequestHeaders.Add("MessageID", "30010");
var exrate = new exrate()
{
AmountTransaction = "1.00",
CurrencyCodeTransaction = "704",
AcquirerInstitutionIdentificationCode = "12345678",
CurrencyCodeSettlementAcquirer = "704"
};
HttpResponseMessage responsePost = await client.PostAsJsonAsync("v1.0/exrate", exrate);
if (responsePost.IsSuccessStatusCode)
{
// Get the URI of the created resource.
Uri returnUrl = responsePost.Headers.Location;
Console.WriteLine(returnUrl);
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("Success : " + resp);
}
else
{
var resp = responsePost.Content.ReadAsStringAsync().Result;
Console.WriteLine("{0} ({1})", (int)responsePost.StatusCode, responsePost.ReasonPhrase);
Console.WriteLine("Error : " + resp);
}
}
Console.Read();
}

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 18


Input Parameters:

Name Type Description


Head Header API Header parameters
Request ExchangeRateRequest Request
licenseeId String Licensee Id

Return Type: Exchange Rate Response with all the parameters.

Name Type Description


The transaction amount in the local transaction
amountTransaction
BigDecimal currency
currencyCodeTransaction String Transaction Currency Code
acquirerInstitutionIdentificationCode String Acquirer Institution Identification Code
currencyCodeSettlementAcquirer String The settlement currency code for the Acquirer
The settlement amount in the settlement currency
amountSettlementAcquirer
BigDecimal for the Acquirer
The conversion rate from the transaction currency
conversionRateSettlementAcquirer
BigDecimal to the settlement currency for the Acquirer
conversionDateSettlementAcquirer String Conversion date to Acquirer
responseCode String Response Code

7 Annexure
Please use the Read me file in the attached zip files.

SL No Type Remarks

1 Acquirer Sample code

2 Issuer Sample code

********************* End of Document **************************

© 2019 JCB and/or its subsidiaries. All Rights Reserved. 19

You might also like