Skip to content

Generate QR

| View as Markdown

This API is for generating Dynamic QR: QR that is generated each time for a new transaction for UPI payments. Thus, the merchant will be adding amount needed to be paid by customer before generating the QR for each transaction. Once the payment is successful, the QR will be expired.

https://kraken.airpay.co.in/airpay/api/generateOrder
FieldTypeDescription
Content-TypeStringapplication/json
FieldTypeRequiredDescription
mercidintYesMerchant ID (length 1-20)
orderidStringYesUnique reference number (length 1-30)
amountDecimalYesAmount with two decimals (length 1-6 .2)
tidStringNoTerminal id of POS devices (length 15)
buyerPhoneStringYesConsumer mobile number (length 10)
buyerEmailStringYesConsumer email id (length 5-50)
mer_domStringYesMerchant whitelisted domain passed as base64_encode (length 64)
customvarStringNoAny customized info affiliate can pass. Additional values need to be passed with | separator (length 10-100)
call_typeStringYesUse upiqr to generate QR (length 1-20)
checksumStringYesChecksum generation:
Key generated by : key256 = hash('SHA256', username."~:~".password);
alldata = mercid.orderid.amount.tid.buyerPhone.buyerEmail.mer_dom.customvar.call_type;
Checksum generated by : checksum = hash('SHA256', key256.'@'.alldata.date('Y-m-d'));
encDataStringYesConvert alldata to JSON and encrypt using AES-256-CBC algorithm with EncryptionKey.
IV = bin2hex(openssl_random_pseudo_bytes(8));
raw = openssl_encrypt(json_data, AES-256-CBC, EncryptionKey, OPENSSL_RAW_DATA, IV);
encData = IV.base64_encode(raw);
EncryptionKey will be provided by Airpay.
{
"encData": "eyJtaWQiOiIxODk5OSIsInZlcnNpb24iOiJ2MSIsInRpZCI6IiIsInJlZl91cmwiOiIiLCJjaGVja3N1bSI6IiIsIm1lcl9kb20iOiJhSFIwY0RvdkwyeHZZMkZzYUc5emRBPT0iLCJzdXJjaGFyZ2VfYW10IjoiIiwiY3VzdG9tdmFyIjoiIiwiY2FsbF90eXBlIjoidXBpcXIiLCJ1cGlfbW9kZSI6InFyX2NvZGUifQ==",
"checksum": "f3c28b55c93a3f1090e0b6fcc1f9f0a1735c0267de29893f20ded51c71e6de20",
"mercid": "767807"
}
FieldTypeDescription
dataStringData will in encrypted format, decrypt it AES-256-CBC algorithm using EncryptionKey
IV = substr(encryptedData, 0, 16);
data = substr(encryptedData, 16);
DecryptedData = openssl_decrypt(base64_decode(data), AES-256-CBC, EncryptionKey, options=OPENSSL_RAW_DATA, IV); EncryptionKey Airpay will be provide this value.
{
"data": "zdXJfbW9kZSI6InFyX2NveyJtaWQiOiIxODk5OSIsInZlcnNpb24iOiJ2MSIsInRpZCI6IiIsInJlZl91cmwiOiIiLCJjaGVja3N1bSI6IiIsIm1lcl9kb20iOiJhSFIwY0RvdkwyeHZZMkZzYUc5emRBPT0iLCJzdXJjaGFyZ2VfIjoiIiwiY2FsbF90eXBlIjoidXBpcXIiLCJ1cGlfbW=="
}
{
"QRCODE_STRING": "upi://pay?pa=example@icici&pn=Adam%20Innovations%20Test&cu=INR&tn=Pay to Adam%20Innovations%20Test&am=1.00&mc=5045&mode=04&tr=APS17722152&td=APS17722152",
"MID": 18999,
"RID": 17722152,
"status": 200
}