Skip to main content

2. API SPECIFICATION

2.1. GENERAL PAYLOAD

Named request/response model WsTxnRecord will be used for passing information through the QR Parsing as well as Transaction Process; depending upon the phase the fields have variable use case. Further details of the fields are explained in detail:

FieldTypeDescription
txn_id StringUnique channel id for each transaction (validation trace id generated during dynamic QR)
channel StringClient from where web socket connection request originates. GWQR | NQR
merchant_id StringTerminal ID
ws_id StringUnique Id to identify each client request and used for response
message StringDifferent activity message.
status StringPhase: QR Parsing

ENTR PARSED

Phase: QR Transaction COMPLETED FAILED
debit_statusStringDebit status field is only applicable on QR Transaction Phase. Phase: QR Transaction Success: 000 (Rest Failed)
credit_status StringCredit status field is only applicable on QR Transaction Phase. Phase: QR Transaction Success: 000/999/DEFER (Rest Failed)

2.2 CONNECTION ESTABLISHMENT

In order to perform bi-directional web socket communication client must first initiate the connection request.

DirectionClient -> WS Request
URL/nqrws

2.2.1 Subscribe

To get the data back from WS server, client must subscribe to given end point.

DirectionClient -> WS Request
URL/user/nqrws/check-txn-status

2.2.2 Transaction Detail Request

Send information of transaction details such as merchant id and transaction id.

DirectionRequest
URL/nqrws/check-txn-status

Request Payload:

FieldFormatDescription
merchant_idStringMerchant PAN
request_idStringUnique transaction id (validation trace id generated during dynamic QR)
usernameStringUsername (will be provided)
api_tokenStringAPI Token (will be provided)

Example Payload:

{
"merchant_id": "MER-980-APP-1",
"request_id":"770342",
"username":"username",
"api_token":"WAxGtlKbhV3NE+d3DB3mfzgj2hD2oS6j46NuPJm/9yB1yhVsRM1tWfyj9yGdJv1GMlZTfbRWzybdiQAUQ+TryuAIbEfTXEPJ6DURIv5g6AbeCl7RitiyILRiKnPPiBPTMtv0R7v4bIr/o6qQBdYZL4BJ7fXFsOddium0RDmaQVLfjrc0qjxh/LXLOnSQcgyXtLgQGFIaLt84AGozYx6kpYv9kipo8DxWGJ7pdPl5y8NNvmzG7IEdaaHytKt/fd3ci3zF2kLBOdY/RNC34t0LFJwuPpf6C0dlk4c+MciAth9dzxHenXZ7x0seSrxttcB+gRcg/V61c1x02AfyD7lQ=="
}

Response Structure:

FieldFormatDescription
statusStringWeb socket QR transaction status
channelStringClient channel name
messageStringInformation message
merchant_id StringMerchant id
request_idStringUnique transaction id
ws_id StringUnique web socket id

Example Response:

{
"status": "ENTR",
"channel": "GWQR",
"message": "Connection Established",
"merchant_id": "MER-980-APP-1",
"request_id": "10034234",
"ws_id": "20230604074816685e7def11c-6fd7-4aa9-ab13-2c9f0c22299d"
}

API Token must be encrypted with public key and passed in the request for establishing connection. Public key will be provided by NCHL. The encryption algorithm should be “RSA/ECB/PKCS1Padding”.