Skip to main content

1. Introduction

1.1 Merchant QR Generation

Merchant QR generation process includes the interface between the merchant system and NEPALPAY QR network. This interface specification describes a technical level communication of data exchange between the merchant system and the NEPAYPAY QR system.

1.1.1. Authentication and Authorization

Basic Authentication is a common method of authenticating to an API. The client sends HTTP requests with the Authorization header that contains the Basic word followed by a space and a base64-encoded username: password string.

Header key = 'Authorization'

Value = 'Basic '+ base 64 encoding of a username and password separated by a colon.

Authorization: Basic ZGVtbzpwQDU1dzByZA==

Example:

curl --location 'https://<host: port>/qr/generateQR' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic cGxhem1hdDpBYmNkQDEyMw==' \
--data '{
"pointOfInitialization": 12,
"acquirerId": "00002501",
"merchantId": "2501ELFDRY2",
"merchantName": "Plazma Tech",
"merchantCategoryCode": 4121,
"merchantCountry": "NP",
"merchantCity": "Kathmandu",
"merchantPostalCode": "4600",
"merchantLanguage": "en",
"transactionCurrency": 524,
"transactionAmount": "10.00",
"valueOfConvenienceFeeFixed": "0.00",
"billNumber": "012345",
"referenceLabel": null,
"mobileNo": null,
"storeLabel": "Store1",
"terminalLabel": "Terminal1",
"purposeOfTransaction": "Bill payment",
"additionalConsumerDataRequest": null,
"loyaltyNumber": null,
"token": "a1e0pTCtdgqny2BBPgKT/9EaLrRA0J99PYlNyjM5887nkebzvaKtsHT/aciZxXmqsnYMnktXJmseFIsiyE+06476RXrQaCNLEZ4LvsraSz5VWrb/ysA5HgFMqcXyRVCYkC4Ye5Uqbi87wbEyj1bb6Cb2yqDAOGm4uGmn7T5W9Gc="
}'

Post: /qr/generateQR

Request from Merchant to NPI for QR generation.

#Data ItemsTypeLengthRequired Remarks
1pointOfInitialization Integer2 M Point of Initiation Method (Use 11 for static QR and 12 for Dynamic QR)
2acquirerIdString MAcquirer of the QR code
3merchantIdStringmCreditor Id/ Merchant Code
4merchantName String25MMerchant Name
5merchantCategoryNumeric4MMerchant Category Code
6merchantCityStringMCity
7merchantCountryStringMCountry code
8merchantPostalCodeString M Merchant’s Zip Code/Pin Code/Postal Code
9transactionCurrencyInteger3MCurrency code (eg. 524 for Nepali rupee)
10transactionAmountNumeric(12,2)MAmount. 0.00 if none.
11valueOfConvenienceFeeFixedNumeric(10,2)O Transaction Fee, if the transaction costs additional fee for the customer.
12billNumberString 25O Bill No of merchant. 0 if none.
13referenceLabelString 25O
14storeLabelString 25O Store label of the QR code.
15terminalLabelString 25O Terminal id of the QR code.0 if none.
16purposeOfTransactionString 25OPurpose of transaction.
17addnField1-addnField10String 25O Additional fields 1 to 10 for additional usages.
18TokenString MSHA 256 Signture Token

Request Sample:

{
"pointOfInitialization":12,
"acquirerId":"00001701",
"merchantId":"17012UVSTIR",
"merchantName":"BBSM",
"merchantCategoryCode":5021,
"merchantCountry":"NP",
"merchantCity":"Kathmandu",
"merchantPostalCode":"4600",
"merchantLanguage":"en",
"transactionCurrency":524,
"transactionAmount":"0.00",
"valueOfConvenienceFeeFixed":"0.00",
"billNumber":"012345",
"referenceLabel":null,
"mobileNo":null,
"storeLabel":"1524525335",
"terminalLabel":"Terminal1",
"purposeOfTransaction":"Bill payment",
"additionalConsumerDataRequest":null,
"loyaltyNumber":null,
"token":"PcK7JFPfEUvtGouuShjQgten7HQsAxxGVZJ+38ORzEOCEMV3Dlt7V0M7g+HUBfn0+oHZqAsb2pzTQHWEQPLmPOGR4lVEoy581vYmN5PfMLSQqb/UxixT1O4X6ZFeV9sVivP3Y1gVfILPIzRm2CfML4BTHhDlpNvoOQ840nvNn2E="
}
TokenString: acquirerId+”, “+merchantId +”, “+merchantCategoryCode+”, “+transactionCurrency+”, “+
transactionAmount+”, “+billNumber+”, “+userId"

Note: userId is a NPI user provided to the merchant.

Successful Response:

{
"timestamp": "2022-05-23 04:25:26",
"responseCode": "000",
"responseStatus": "SUCCESS",
"responseMessage": "QR String generated successfully.",
"data": {
"validationTraceId": "2205260000001900KIY",
"qrString": "00020100020101021229270023NCHL0000170117012UVSTIR52045021530352454040.0056040.005802NP5904BBSM6009Kathmandu6271010100306Khalti0709Terminal10812Billpayment512300192205260000001900KIY6304607F"
}
}

The highlighted section above is the sub tag 51 of field 62 which is validation id generated by NCHL during QR generation. This validation trace id will be used for end to end reporting and reconciliation.

Response

#Data ItemsTypeLengthRequired Remarks
1validationTraceId String20 M Unique QR validation Id provided by NCHL during QR generation.It will be used for end to end reporting and reconciliation
2qrStringStringQR string to be used for QR generation and display.

Unsuccessful Response

You will get error details in responseResult (i.e. responseCode, responseDescription and fieldErrors) respectively

Successful Response When qrImage Tag Is True:

The highlighted section above is the sub tag 51 of field 62 which is validation id generated by NCHL during QR generation. This validation trace id will be used for end to end reporting and reconciliation.

#Data ItemsTypeLengthRequiredRemarks
1validationTraceIdString20MUnique QR validation Id provided by NCHL during QR generation.It will be used for end to end reporting and reconciliation.
2qrStringStringQR string to be used for QR generation and display.
3qrImageStringCBase64 encoded QR Image.
{
"timestamp": "2024-01-09 11:44:40",
"responseCode": "000",
"responseStatus": "SUCCESS",
"responseMessage": "QR String generated successfully.",
"data": {
"qrString": " 00020100020101021229270023NCHL000023012301JR0R2KT52044111530105406290.14560105802NP5907BigMart6009Kathmandu62830109ABC0001540312Bikash Saran0409A123412340710ConnectIPS512300192401090000204270ZTV6304EC0E",
"validationTraceId": "2401090000204270ZTV",
"qrImage": "iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAIAAAD2HxkiAAAHuUlEQVR42u3bUW7lOBADwHf/S2duMEDw1GRLKf46cWyrSwtwtJ8fEanm4xOIQCgCoYhAKAKhiEAoAqGIQCgCoYhAKAKhiEAoAqGIQCgCoYhAKAKhiEAoAqGIQCgCoYhAKAKhiEAoAqGIQCgC4f/vmMqvHuObqwcfsnV17vXnHqO1ZN9MHYQQQgghhBBCCCGEEEIIIYQQLkMYu3Psy34zOq3HmLvVp5QlUwchhBBCCCGEEEIIIYQQQgghhFchbDVvS1rZWFv4q6/xzQ/PZa52XsIbQgghhBBCCCGEEEIIIYQQQggfQtg68zW3hLE2uMUstiVBCCGEEEIIIYQQ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HgBBCCCGEEEIIIYQQQgghhBBCESkFQhEIRSAUEQhFIBQRCEUgFBEIRSAUEQhFIBQRCEUgFBEIRSAUEQhFIBQRCEUgFBEIRSAUEQhFIBQRCEUgFBEIRSAUkYP5B2StCp2MVFH1AAAAAElFTkSuQmCC"
}
}

Sample QR Image:

To generate the QR image, decode the output of qrImage tag  above with base64 to Image. 

Example Image

Failed Response

{
"responses": [
{
"responseCode": "400",
"responseDescription": "PARAMETER VALIDATION ERROR",
"fieldErrors": [
{
"field": "pointOfInitialization",
"message": "Please use (11 for static QR and 12 for dynamic QR)."
}
]
},
{
"responseCode": "E003",
"responseMessage": "INVALID TOKEN",
"data": "",
"classfielderrorlist": []
}
]
}

Not Found

{
"responseCode": "E010",
"responseMessage": "RECORD NOT FOUND:- Merchant not found!",
"data": null,
"classfielderrorlist": []
}

Internal Server Error-500

{
"responseCode": "E999",
"responseMessage": "ERROR",
"data": null,
"classfielderrorlist": []
}

In case of service not available

{
"timestamp": "2022-05-26 04:07:22",
"responseCode": "E999",
"responseMessage": "ERROR",
"data": null
}