Print Invoice QR Generation API

Use this API to generate Dynamic UPI QR which can be printed on merchant Invoice. Each QR can be associated to respective Amount and Order no which can be used to accept unique payments. GST details can also be captured and linked during QR code generation.

Example

Print Invoice QR API can be used by large distributors who accept payments from their buyers by raising periodic Invoice and payment is made by the buyers post receipt of the Invoice. Here these distributors can generate Print Invoice QR and print it in the Invoice which basically gives the buyers an option to scan and make UPI based payments against the invoice. Since the QR will have invoice details embedded during generation transactions are automatically reconciled.

This API generate UPI or BQR QR. This API returns either Base64, string or image format of the QR based on the request type.

Request Parameters

ParameterDescriptionSample Value
key
mandatory
string This parameter must include the merchant key that was provided by PayU.
Reference: For more information on how to generate the Key and Salt, refer to any of the following:

Production: Generate Production Merchant Key and Sat.
Test: Generate Test Merchant Key and Salt.
Your Test Key
command
mandatory
string The parameter must contain the name of the web service. For this API, generate_invoice_qr must be posted.generate_invoice_qr
hash
mandatory
string This parameter must contain the hash value to be calculated at your end. The string used for calculating the hash is mentioned below:

sha512(key|command|var1|salt)

sha512 is the encryption method used here.
ajh84babvav
var1
mandatory
json This parameter will include a JSON format of the transaction details. For more information, refer to the >.Refer the VAR SAMPLE section.

Fields in var1 Parameter Description

FieldDescriptionExample
transactionId
mandatory
string This must contain the merchant transaction Identifier. This must be unique (after a successful transaction) & alphanumeric special (less than 40 characters & excluding >,<, &, ‘)1234_abcdedf
transactionAmount
mandatory
float This must contain the amount for which QR needs to be generated. This must be greater than or equal to 1.00.1005, 1042.23, 95494.4, 10000.00
merchantVpa
optional
string This must contain the merchant's VPA in which payment will be collected. If not sent, VPA registered against given merchant Key is used.yellowqr. payu@hdfc
expiryTime
optional
numeric This must contain the 
time in seconds for which the QR is active. If empty, merchant level expiry is used. If there is no merchant level value, the global value is used.3600
qrName
merchantVpa
optional
string This field is used to post the merchant's name to be embedded in the QR. If the value is not posted, the merchant’s name registered during the onboarding process will be used.PayU
qrCity
merchantVpa
optional
string This parameter is used to post the merchant's city that will be embedded in the QR. If the value not posted, merchant’s city registered during the onboarding process will be used.Gurgaon
qrPinCode
optional
string This field is used to post the merchant's PIN code to be embedded in the QR. If not sent, merchant’s PIN code registered during the onboarding process will be used.122001
customerName
optional
string This field must contain the customer name.Ravi
customerCity
optional
string This field must contain the customer city.122001
customerPhone
optional
string This field must contain the customer phone number.9833207164
customerEmail
optional
string This field must contain the customer email address.[email protected]
customerAddress
optional
string This field contains the customer's address.It can be up to 100 characters. Anything after the first 100 characters will be ignoredPayu, Bestech Business Tower, Gurgaon
udf3 - udf5
optional
string This field must contain the user-defined fields such as udf3, udf4 and udf5 can be sent in request to include any transactional information.-
qrType
optional
string This field is used to indicate whether BQR or UPI QR need to be generated and can contain any of the following values:

bqr
upi
upi or bqr
outputType
optional
string This field is used to indicate the QR output format and contain any of the following:

base64
string
image format
base64, string, image
gst
optional
string This must contain the applicable GST amount for that transaction. Only applicable in case you want to embed gst specific details in the QR.100.25
cgst
optional
string This is the applicable CFST amount for that transaction. Only applicable in case you want to embed GST specific details.25.45
sgst
optional
string This must contain the SGST amount for that transaction. Only applicable in case you want to embed GST specific details in the QR.25.45
igst
optional
string This must contain the IGST amount for that transaction. Only applicable in case you want to embed GST specific details in the QR.50.9
cess
optional
string This must contain the cess amount for that transaction. Only applicable in case you want to embed gst specific details in the QR.10.2
gstIncentive
optional
string This must contain the GST Incentive amount for that transaction. Only applicable in case you want to embed GST specific details in the QR.10.2
gstPercentage
optional
string This must contain the GST percentage for that transaction. Only applicable in case you want to embed GST specific details in the QR.18
gstIn
optional
string This is the GSTIN of the legal entity of the merchant. Only applicable in case you want to embed GST specific details in the QR.24AAACC1206D1ZM
invoiceName
optional
string This is the name of the invoice for which QR will be used. Only applicable in case you want to embed GST specific details in the QR.Bill
invoiceNo
optional
string This is the invoice number for which QR will be used. Only applicable in case you want to embed GST specific details in the QR.78457637
invoiceDate
optional
string This is the invoice date for which QR will be used. It should always be in GMT format. Only applicable in case you want to embed GST specific details in the QR.2021-05-21T13:21:50+05:30
purpose
optional
string This is the purpose for which QR will be used. This param will have fixed values basis your business type. Please take the value from our integration team.3
refUrl
optional
string This field can be used to share invoice copy or any other transaction related information/documents to customer for their reference.https://payu.in/
category
optional
string This field is mandatory when refUrl is passed. Use any of the following based on the purpose:

01 for advertisement
02 for invoice.
01 or 02
txnNote
optional
string This field is used if any transaction remarks should be shown to customer.Loan Repayment

var1 Sample

The var1 parameter is similar to the following JSON format and description of fields in the JSON is described in the following table:

{
  "transactionId": "delhivery_1",
  "transactionAmount": "1",
  "merchantVpa": "yellowqr.payutestdynamicqr@hdfcbank",
  "expiryTime": "3600",
  "qrName": "ronaldo",
  "qrCity": "gurugram",
  "qrPinCode": "122001",
  "customerName": "Messi",
  "customerCity": "hyderabad",
  "customerPinCode": "500072",
  "customerPhoneNumber": "7060334501",
  "customerEmail": "[email protected]",
  "customerAddress": "bestech business tower, sohna road, sector 48, gurgaon,122001",
  "gst": "110",
  "cgst": "25",
  "sgst": "25",
  "igst": "50",
  "cess": "10",
  "gstIncentive": "10",
  "gstPercentage": "18",
  "gstIn": "24AAACC1206D1ZM",
  "invoiceName": "Javed H",
  "invoiceNo": "78457637",
  "invoiceDate": "2021-05 21T13:21:50+05:30",
  "purpose": "03",
  "refUrl": "https://payu.in/",
  "category": "02",
  "txnNote": "Loan Payment"
}

Sample request

curl --location --request POST 'https://info.payu.in/merchant/postservice.php?form=2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'command=generate_invoice_qr' \
--data-urlencode 'key =J****g' \
--data-urlencode 'hash =c0110b439987304598edc8871e4b134262dbbd6b3b64532fa2731d50aadf03c5dec0958de560a2011b35f01a719ab8ca246bfd6dcfa6ecf4b4100b07e0635322' \
--data-urlencode 'var1 ={"transactionId":"DBQR000479","transactionAmount":"1","outputType":"string","qrType":"upi"}'

Response parameters

OutputTypeDescription
imageImage of the QR code will be returned, either BQR or UPI QR
string
stringQr String is plain text will be returned in response along with QR ID & VPA associated to the QR, the QR string can be converted into image and used for accepting transactions
base64Base 64 encoded string will be returned in response along with QR ID & VPA associated to the QR, the encoded string provides a layer of security which can be eventually converted into image and used for accepting transactions

Sample response

  • UPI
{
  "qrString": "upi://pay?pa=gauravdua1.payu@indus&pn=J****g&mc=7399&tr=P-424951&ver=01&mode=15&orgid=000000&qrMedium=06&cu=INR&purpose=02&pinCode=122002&am=1.00&QRexpire=2021-08-25T21:58:08+05:30",
  "msg": null
}
  • BQR
{
  "qrString": "000201010211021644038470007469080415522024070007469061661000307000746960825HDFC00006225020001855322626470010A0000005240129yellowqr.payutest.94@hdfcbank27370010A0000005240119STQ9y45z1cv3z5450925204569153033565802IN5910vendorName6010vendorCity610650017262350519STQ9y45z1cv3z545092070870007469630417EF",
  "msg": null
}