QR Codes
Generate a dynamic QR Code for a specific merchant terminal.
POST /v1/qr/generate/dynamic
Sample
json
POST v1/qr/generate/dynamic
{
"terminalReference": "25441723-1A78-4345-A667-2C462DA525F1",
"qrCodeType": 2,
"invoiceNumber": "210920210735",
"amountInCents": 133
}Auth: Access token (Bearer).
Request body
| Field | Type | Required | Description |
|---|---|---|---|
terminalReference | string | Yes | A globally unique terminal reference (UUID) generated internally by the system. |
qrCodeType | NONE, V2QR, GHQR, NIBSSQR, ZapperQR, SnapScanQR, PayShapQR, MtnMoMoQR | Yes | Identifies the QR code payment scheme associated with a terminal QR code or payment session. |
invoiceNumber | string | Yes | An invoice number, also referred to as a bill number. |
amountInCents | integer | Yes | The amount, in cents, to embed into the dynamic QR code. |
json
{
"terminalReference": "00000000-0000-0000-0000-000000000000",
"qrCodeType": "NONE",
"invoiceNumber": "string",
"amountInCents": 0
}Responses
| Status | Description |
|---|---|
200 | The request was successful but does not return any results. |
400 | The request failed validation, the error object will contain further information. |
401 | The authorization information provided is not valid, authentication is required to access this resource. |
403 | The authorization header does not contain the correct type or you do not have access to this resource. |
404 | The request was successful but does not return any results. |
422 | The request payload is invalid, the error object will contain further information. |
429 | Too many requests are being sent concurrently or rate limiting has taken effect. |
500 | An unexpected error occurred, the error object will contain further information. |
Response body
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | No | Gets a value indicating whether the operation was successful. |
result | string? | No | Gets the response payload. |
json
{
"success": true,
"result": "string"
}Code samples
ts
// @vantagepay/vantagepay
// Not available in the JavaScript SDK. Use client.qrCodes.generate(text) to render an image
// from an existing payload, or use the .NET SDK to generate a dynamic QR server-side.
const qrImage = await client.qrCodes.generate('https://pay.vantagepay.dev/...', 500)csharp
// VantagePay.SDK
using VantagePay.Models.Lookups;
var qrPayload = await client.QrCodes.GenerateDynamicQrCodeAsync(Guid.Parse("a1b2c3d4-e5f6-7890-abcd-ef1234567890"), QrCodeType.GHQR, "INV-1001", 5000);Checks if the system is capable of processing a QR code.
POST /v1/validate/qr
Sample
json
POST /v1/validate/qr
{
"qrCode": "00020101021251510007V2EmvQR01368e3b8880-3f6c-48e6-b0fc-561ae9d9f0d502164957030013982287520459935802GH5914AllanVisaTest26005Accra61052302154041.00530393662360108202110060506ZGA-560710Terminal 163043E24"
}Auth: Access token (Bearer).
Request body
| Field | Type | Required | Description |
|---|---|---|---|
qrCode | string | Yes | A QR Code string that you would like validated. |
json
{
"qrCode": "string"
}Responses
| Status | Description |
|---|---|
200 | The system is capable of processing the submitted QR code. |
400 | The request failed validation, the error object will contain further information. |
401 | The authorization information provided is not valid, authentication is required to access this resource. |
403 | The authorization header does not contain the correct type or you do not have access to this resource. |
422 | The request payload is invalid, the error object will contain further information. |
429 | Too many requests are being sent concurrently or rate limiting has taken effect. |
500 | An unexpected error occurred, the error object will contain further information. |
Response body
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | No | Gets a value indicating whether the operation was successful. |
result | object | No | A model to hold the details of a QR Code validation response. |
json
{
"success": true,
"result": {
"canProcess": true,
"supportedQrCodes": "string"
}
}Code samples
ts
// @vantagepay/vantagepay
const result = await client.payments.validateQrCode({ qrCode: '000201010211...' })csharp
// VantagePay.SDK
using VantagePay.Models.Payments;
var result = await client.QrCodes.ValidateQrCodeAsync(new QrCodeValidationRequest { QrCode = "000201010211..." });Generate an EMV QR Code.
POST /v1/qr/generate/emv
Sample
json
POST /v1/qr/generate/emv
{
"qrType": "EmvCore",
"qrPresentationType": "Static",
"merchantInfo": {
"merchantName": "Test Merchant",
"merchantCategoryCode": 8299,
"countryInfo": {
"countryName": "Ghana",
"twoAlphaIsoCode": "GH",
"threeAlphaIsoCode": "GHA"
},
"cityName": "ACCRA",
"postalCode": "",
"visaPan": "4045871737852",
"mastercardPan": "532631101061981",
"languageInfo": null,
"siteId": null,
"merchantId": null
},
"transactionInfo": {
"transactionCurrency": {
"currencyName": "Ghana Cedi",
"threeAlphaIsoCode": "GHS",
"numericIsoCode": 936
},
"tipOrConvenienceFeeInfo": {
"mustPromptForTip": false,
"convenienceFeeFixed": null,
"convenienceFeePercent": null
}
},
"additionalInfo": {
"promptForInvoiceNumber": false,
"invoiceNumber": "",
"promptForStoreLabel": false,
"storeLabel": "86567306",
"promptForReferenceLabel": false,
"referenceLabel": "",
"promptForTerminalLabel": false,
"terminalLabel": "86567306",
"promptForPurposeOfTransaction": false,
"purposeOfTransaction": "",
"transactionInitiationRequirements": {
"mustProvideConsumerAddress": false,
"mustProvideConsumerEmailAddress": false,
"mustProvideConsumerMobileNumber": false
},
"consumerInfo": {
"promptForMobileNumber": false,
"mobileNumber": "",
"promptForLoyaltyNumber": false,
"loyaltyNumber": "",
"promptForConsumerLabel": false,
"consumerLabel": ""
},
"paymentSystemSpecificInfo": {}
},
"merchantAccountInfo": {
"2": {
"globalUniqueIdentifier": "4045871737852",
"contextSpecificData": {}
},
"4": {
"globalUniqueIdentifier": "532631101061981",
"contextSpecificData": {}
}
},
"unreservedFieldInfo": {}
}Auth: Access token (Bearer).
Parameters
| Name | In | Required | Description |
|---|---|---|---|
format | query | No | The response output format required. The default is a Base64. |
logoImageUrl | query | No | Optional logo image URL. |
logoImageSize | query | No | Optional logo image size that is only relevant if logoImageUrl is also supplied. |
Request body
json
{}Responses
| Status | Description |
|---|---|
200 | The request was successful but does not return any results. |
400 | The request failed validation, the error object will contain further information. |
401 | The authorization information provided is not valid, authentication is required to access this resource. |
403 | The authorization header does not contain the correct type or you do not have access to this resource. |
422 | The request payload is invalid, the error object will contain further information. |
429 | Too many requests are being sent concurrently or rate limiting has taken effect. |
500 | An unexpected error occurred, the error object will contain further information. |
Response body
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | No | Gets a value indicating whether the operation was successful. |
result | string? | No | Gets the response payload. |
json
{
"success": true,
"result": "string"
}Code samples
ts
// @vantagepay/vantagepay
// Generates an EMV-compliant merchant QR code.
// Not wrapped by the JavaScript SDK - call the endpoint directly with the active token.
const response = await fetch(baseUrl + '/v1/qr/generate/emv', {
method: 'POST',
headers: { Authorization: 'Bearer ' + ApiTokens.accessToken },
})
const result = await response.json()csharp
// VantagePay.SDK
// Generates an EMV-compliant merchant QR code.
// Not wrapped by the .NET SDK - call the endpoint directly with an authorized HttpClient.
using var http = new HttpClient { BaseAddress = new Uri("https://sandbox-api.vantagepay.dev") };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", client.ApiTokens.AccessToken);
var response = await http.PostAsync("/v1/qr/generate/emv", content: null);
response.EnsureSuccessStatusCode();A method that is able to decode all of the industry standard types of QR Codes supported by this library.
GET /v1/qr/decode
This decoder will figure out what type of QR Code data you have sent it automatically, provided that you pass it a QR data string that conforms to one of the formats it supports.
Sample
json
GET /v1/qr/decode?qrCodeData="00020101021132790018GH.NET.GHIPSS.GHQR01161003364500003365020601000003030010416E20210530T12000052049702530393654062050.45802GH5913Covid Support6006KUMASI610800000001623103150000000000167270708315241196304863A"Auth: Access token (Bearer).
Parameters
| Name | In | Required | Description |
|---|---|---|---|
qrCodeData | query | No | A QR Code data string. |
Responses
| Status | Description |
|---|---|
200 | The request was successful but does not return any results. |
400 | The request failed validation, the error object will contain further information. |
401 | The authorization information provided is not valid, authentication is required to access this resource. |
403 | The authorization header does not contain the correct type or you do not have access to this resource. |
422 | The request payload is invalid, the error object will contain further information. |
429 | Too many requests are being sent concurrently or rate limiting has taken effect. |
500 | An unexpected error occurred, the error object will contain further information. |
Response body
| Field | Type | Required | Description |
|---|---|---|---|
success | boolean | No | Gets a value indicating whether the operation was successful. |
result | object | No |
json
{
"success": true,
"result": {
"merchantInfo": {},
"qrType": 0,
"qrTypeDescription": "string",
"qrPresentationType": 0,
"qrPresentationTypeDescription": "string",
"transactionInfo": {},
"additionalInfo": {},
"merchantAccountInfo": {},
"unreservedFieldInfo": {}
}
}Code samples
ts
// @vantagepay/vantagepay
const decoded = await client.qrCodes.decode('000201010211...')csharp
// VantagePay.SDK
// Decodes a QR code payload. Not wrapped by the .NET SDK.
// Not wrapped by the .NET SDK - call the endpoint directly with an authorized HttpClient.
using var http = new HttpClient { BaseAddress = new Uri("https://sandbox-api.vantagepay.dev") };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", client.ApiTokens.AccessToken);
var response = await http.GetAsync("/v1/qr/decode?qrCodeData=000201010211...");
response.EnsureSuccessStatusCode();