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/pay/v4/api/generateorder/?token=<access_token>
ParameterType ValueDescriptionValue Like
Content-Type requiredStringThe Content-Type header indicates the media type of the request or response body so the receiver knows how to process the data.application/json
ParameterType ValueDescriptionValue Like
orderid requiredAlphanumeric
(1-30)
Merchant generated transaction idORD1234
amount requiredNumeric
(1-10 .2)
Amount with two decimals100.00
tid optionalString
(15)
Terminal id of pos devices
buyer_email requiredEmail
(3-50)
Buyer Emailcustomer@example.com
buyer_phone requiredNumeric
(8-15)
Buyer Phone99999999
mer_dom optionalAlphanumericBase64 encoded merchant domain.aHR0cDovL2xvY2FsaG9zdA==
customvar optionalAlphanumericSpaceEqual
(1-4096)
call_type requiredString
(1-20)
Use upiqr to generate QRupiqr
customer_consent requiredchars
(1)
Consent flag to be sent by Merchant.
Allowed values: Y, N
Y
ParameterType ValueDescriptionValue Like
qrcode_string requiredStringQR Code Stringupi://pay?pa=example@icici&pn=Adam%20Innovations%20Test&cu=INR&tn=Pay to Adam Int&am=1.00&mc=5045&mode=04&tr=APS17722152&td=APS17722152
ap_transactionid requiredStringTransaction Identifier17722152
status requiredStringStatus Code200
<?php
$merchant_id = "<merchant_id>";
$username = "<username>";
$password = "<password>";
$secret = "<secret>";
$secretKey = '<secretKey>';
$data = array();
$data['orderid'] = "ORD123456";
$data['amount'] = "1000.00";
$data['buyer_email'] = "customer@example.com";
$data['buyer_phone'] = "99999999";
$data['call_type'] = "upiqr";
$privatekey = hash('sha256', $secret.'@'.$username.':|:'.$password);
$encdata = encrypt(json_encode($data), $secretKey);
$checksum = checksum($data);
$payload = [
'merchant_id'=>$merchant_id,
'encdata' => $encdata,
'checksum' => $checksum,
'privatekey' => $privatekey
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://kraken.airpay.co.in/airpay/pay/v4/api/generateorde/r?token=<access_token>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $payload
));
$result = curl_exec($curl);
curl_close($curl);
$response = json_decode($result)->response;
HTTP/1.1 200 OK
{
"status_code": "200",
"response_code": "00",
"status": "Success",
"message": "success",
"data": {
"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",
"ap_transactionid":"17722152",
"status":"200"
}
}
HTTP/1.1 200 OK
{
{
"status_code":"400",
"response_code":501,
"status":"fail",
"message":"Invalid Merchant Id",
"data":[]
}
}