Other Transaction Operations

You are here:
  • Main
  • Other Transaction Operations
← All Topics

 

Other than Sale and Auth requests, you may also perform Void, Refund and Query.

 

Signature (Signkey)

In the MCP V5 API, before sending transaction request for void, refund or query, merchant is required to generate a Signature once. This can be done by sending a request to the Terminal Authentication API.

To generate the signature (signkey), first hash ‘data’ string ( “userId”, “password” and “password hash key”) by Hmac SHA512, and to be used as ‘signature’ in requests’ ‘header’ object (Not HTTP Headers). Convert data object to string and hmac SHA512 with “signKey” returned from auth/terminal API

Sample Code in Java:
Gson gson = ​new ​Gson();
String dataJson = gson.toJson(​dataObject​);
String signature = SymmetricCrypto.​hmacSHA512​(dataJson, signKey);

public static ​String ​hmacSHA512​(String dataJson, String key) { ​try ​{
​byte​[] bytesKey = key.getBytes();
​final ​SecretKeySpec secretKey = ​new ​SecretKeySpec(bytesKey, ​HMAC_SHA512​); Mac mac = Mac.​getInstance​(​HMAC_SHA512​);
mac.init(secretKey);
​final byte​[] macData = mac.doFinal(dataJson.getBytes());
​byte​[] hex = ​new ​Hex().encode(macData);
​return new ​String(hex, ​ISO_8859_1)​ ;
} ​catch ​(NoSuchAlgorithmException e) { e.printStackTrace();
} ​catch ​(InvalidKeyException e) { e.printStackTrace();
} ​catch ​(UnsupportedEncodingException e) {s e.printStackTrace();
}
​return null​; }

 

Terminal Authentication

Client’s terminal must be registered to the server and the server will then validate the request parameters and returns the terminal identification, which the client will use for future transactions.

Protocol Format
MediaTypes​: JSON
format Protocol​ : https
Server Port ​: 8443
Method​ : POST
Server URL ​: https://gw2.sandbox.mcpayment.net
EndPoint: ​api/v5/auth/terminal

HTTP Headers:

Message Structure
{
“header” : {…}, “data” : {…}
}
header

Header is common to all the requests and responses.​ ​All messages have same header structure as below

Status is common to all response. Content differs according to request. Refer to table:

Terminal authentication request data

Sample Request:
{
“header”: {
“version”: “5”,
“appType”: “W”,
“appVersion”: “1.00.00”
},
“data”: {
“userId”: “mcp123”,
“password”: “2B2E4C1B8A889684E40633677214F0A0F55C07CDEE210A01E7DE784A0B5E4D9BC5352C273815D991B46E1F33FE05B6648AE07B76CEC02F3B683D5AE88A128B11”
}
}

You will receive a response in the following example:

{
“header”: {
“version”: “5”,
“appType”: “W”,
“appVersion”: “1.00.00”,

“status”: {
“responseCode”: “0000”,
“message”: “Approved”
}
},
“Data”: {
“mcpTerminalId”: “12345671”,
“signKey”: “ShqHvaW/54Y9c/R5o1vNLP1w/7ksoRm+qjTZ3p2GaQA=”,
“routeList”: [
“USD;amexHost”, “SGD;alipayHost”, “SGD;fdHost”, “SGD;wechatHost”
]
}
}

You can use the same signKey (signature) for all other requests. The signKey (signature) can be generated monthly or any frequency you prefer.

 

Void

A credit card Sale that a seller cancels after it has been authorized but before it has been settled.

Terminal sends the Void request to the server. All the data names should follow standard strictly and are case sensitive.

Note: Void can only be applied to transaction not settled yet. The settlement time is set by acquirer.

EndPoint: api/v5/void

Request data:

{
“header”: {
“version”: “5”,
“appType”: “A”,
“appVersion”: “S2.00.00”,
“mcpTerminalId”:”12345671″,
“signature”: “91YL2auzkSIp8Vujg+heOGGmCX+zhB3GhmI2HNG1XCk=”
},
“data”: {
“additionalText”: “”,
“currency”: “SGD”,
“originalTransactionId”: “4951”,
“salesAmount”: “100”
}
}

Response data

{
“header”: {
“version”: “5”,
“appType”: “A”,
“appVersion”: “S2.00.00”,
“status”: {
“responseCode”: “0000”,
“message”:
“Approved” },
“mcpTerminalId”:”12345671″,
“signature”: “91YL2auzkSIp8Vujg+heOGGmCX+zhB3GhmI2HNG1XCk=”
},
“data”: {
“transactionId”: “4952”,
“transactionType”: “300”,
“transactionState”: 2,
“totalAmount”: “100”,
“hostResponseDate”: “20150605121131”,
“clientRequestDate”: “20150605121109”,
“gatewayRequestDate”: “20150605121118”,
“gatewayResponseDate”:”20170606140803″,
“origTnxId”: “4951”,
“stan”: “000027”,
“rrn”: “121131150605”,
“authCode”: “121131”,
“respCode”: “00”,
“currencyCode”: “702”,
“receiptNumber”: “000011”,
“truncatedPan”: “XXXXXXXXXXXX4239”,
“brandName”: “Visa”,
“currency”: “SGD”,
“cardHolderName”: “SAM LIN”,
“gatewayResponseCode”: “00”,
“serviceAmount”: “0”,
“gpsLongitude”: “103.8942417”,
“tipAmount”: “0”,
“gpsLatitude”: “1.3261046”,
“gstRate”: “0”,
“serviceRate”: “0”,
“salesAmount”: “100”
}
}

Company
Merchant
Resources
Connect with us
Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Youtube
Consent to display content from Youtube
Vimeo
Consent to display content from Vimeo
Google Maps
Consent to display content from Google