Create QR codes for invoices

DocsCurrentLast updated: April 6th 2022, @ 4:06:12 pm


Create a QR code associated with your invoice. When a buyer uses a mobile device to scan the QR code, they are redirected to the PayPal mobile payment flow to view the invoice and pay online with PayPal or another payment type.

Know before you code

  • To generate a QR code, first create and send an invoice.
    • If you don't want PayPal to email the invoice notification to your buyer when you create it, because you want to send a QR code, set send_to_recipient in the Send invoice request to false. This parameter updates the invoice status to UNPAID and does not send the email notification.
  • Find the invoice ID that's returned when you create the invoice.
  • This server-side integration uses the Invoicing API.
  • Use Postman to explore and test PayPal APIs.

Market availability

You can create and associate invoice QR codes for the following countries:

  • France
  • Italy
  • Spain
  • United Kingdom
  • United States

1. Create codes

To create a QR code for your invoice, copy the following code and modify it.

Sample request

API endpoint used: Generate QR code

curl -v -X POST \
    https://api-m.sandbox.paypal.com/v2/invoicing/invoices/INV2-Z56S-5LLA-Q52L-CPZ5/generate-qr-code \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>"

Modify the code

After you copy the code in the sample request, modify the following:

  • Change Access-Token to your access token.
  • Change the sample invoice ID, INV2-Z56S-5LLA-Q52L-CPZ5, to the invoice ID that was returned when you created the invoice.

Step result

A successful response results in:

  • A return status code of HTTP 200 OK.
  • A JSON response body that shows the QR code as an encoded Base-64 image, such as:
--2e4a1c93-9ec0-448b-8c6e-c2a691240f2f
Content-Disposition: form-data; name="image"
Content-Type: application/json

iVBORw0KGgoAAAANSUhEUgAAAJYAAACWAQAAAAAUekxPAAAByElEQVR42u2WsW30MAyFabhQ51tAgNdQp5XsBXy+BeyV1GkNAVrA7lQIYp4ucf4L/kZMEaSIoeorKPGRjzTxf1+mP/ZTLBCFQcUz6ckQWRGLnMIt9YX6M3ERstXER4oPlxcTBjELM9OiEO8bjNmPzPpLvDbGKR4UOsdfcmti0C9u5v28aNrEaqkWmzsX7q+1bGJhIT5dPAweoq87Ghk/fB4ATCZLi4zFHZ1CiKQHG08WMSRBM0KquDv9oX0rYzTLptAyXNSnfo0sTHbcXf/g0PlYhOzuIl40WGgQL+0bWTwsbybUuiV96dfIYKwKnsHGVcZ4rxKOT09ffdrKYEeaCNnToGq7SRgkD7NHPFpovO5oZHGjEXU7kZAPJGN59nRzz3i2LzIWJpNvrDumwaL+Isargpt1lzAYxkPG4GZC3SD8Vu0lYjV1ZLDZfE/0oX0r48NgFMFVsGbPQnaynr2GOdiNu4yhSfui4qryQp++bGRcx4nDREE2YZExJJHvKJqBhPHfbmxidd4XUxfFZONqZQz7DXN3JS5EN5Yy3mzdrpPRk5WyPGFHeZSuP1nGEKnzYcCOsjgiVvdbUXlm/E287rwW9ve/9ovYG2Y/Iq/A3o7lAAAAAElFTkSuQmCC
--2e4a1c93-9ec0-448b-8c6e-c2a691240f2f--

2. Test codes

To test your QR code, complete these steps:

  1. Use your preferred programming language or online tool to decode this Base64-encoded value to an image that you can display on your site to your buyers.
  2. Scan the QR code with a QR scanning app to open the invoice in the sandbox.

Next steps

Test and go live