invoicing
Generate QR code
You can generate a quick response (QR) code, or a Base64-encoded PNG image, for an invoice:
- Create a draft invoice.
- Send the invoice to move it from draft to a payable state. If you do not want PayPal to email the invoice notification to your customer, set
send_to_recipient
in the request tofalse
. This parameter updates the invoice status toUNPAID
and does not send the email notification. - To generate the QR code, include the invoice ID in the generate QR code request URL. You can add the QR code to a paper or PDF invoice.
- When a customer uses a mobile device to scan the QR code, he or she is redirected to the PayPal mobile payment flow to view the invoice and pay online with PayPal or a credit card.
This sample request generates a QR code:
curl -v -X POST \
https://api.sandbox.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/generate-qr-code \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token"
A successful request returns the HTTP 200 OK
status code and a JSON response body that shows the QR code as a Base64-encoded image:
{
"--InvoiceQrCodeBoundary7MA4YWxkTrZu0gW\nContent-Disposition: form-data; name=\"qr-code\"; filename=\"qr-code.png\"\nContent-Type: image/png\r\nPNG\r\n...ISO-8859-1 encoded file content...\n--InvoiceQrCodeBoundary7MA4YWxkTrZu0gW--"
}
}
Note: When you use a PayPal SDK, the generate QR call returns a long string. Use your preferred programming language to convert this Base64-encoded value to an image that you can display on your site to your customers.
Next
Continue to Create Templates.