QR Codes .: Get

API Reference / v15

Get a User’s Formatted QR Code (With Preferences)

This endpoint allows you to get a currently valid QR code for a user. To see a user’s QR code, you must have a user access token with the read_qr_code permission.

With this endpoint, you can retrieve a QR code with preferences (like color and tip) already embedded in the code.

If you only want the payment token data, you can use the payment tokens endpoint.

Tips can either be formatted as an amount in cents or as a percentage.

Request Endpoint

GET /v15/qr_codes

Authorization Required – User Token in Header

Authorization: token user="123897-99SCvr3kSe3TqqQid3DyPXfo2Kq98MyhF6CaNPqoDeMhJ18Uopq19uddcznu6R"

Request URL Format

/qr_codes?preferences[color]=0&preferences[tip_amount]=0&preferences[tip_percent]=0

Request Parameters

Parameter Type Required Description
preferences[color] Integer Yes The desired color to be displayed when scanned into a LevelUp Scanner
preferences
[tip_amount]
Integer No The desired tip amount as an integer number of cents
preferences
[tip_percent]
Integer No The desired tip amount as an integer percent (max 100)
width Integer No The desired width of the QR code (if requested as png using Accept header)

Available Colors

Color Number Example
Soothing Green 0
Atomic Lime 1
Tango Red 2
Galactic Blue 3
Purple Haze 4
Yellow Submarine 5
Arctic Teal 6
Sick Flamingo 7
Mint Julep 8
Ninja Orange 9

cURL Example - JSON Response

curl --globoff https://sandbox.thelevelup.com/v15/qr_codes?preferences[color]=0&preferences[tip_percent]=10 \
  -H Accept:application/json \
  -H Content-Type:application/json \
  -H 'Authorization:token user="123897-99SCvr3kSe3TqqQid3DyPXfo2Kq98MyhF6CaNPqoDeMhJ18Uopq19uddcznu6R"'

Example Response - JSON

{
  "qr_code": {
    "code": "LU02000008ZS9OJFUBNEL6ZM0300A0LU"
  }
}

Response Parameters - JSON

Parameters Type Description
code String The user’s current payment token (QR Code) data.

cURL Example - Image/PNG Response

curl --globoff https://sandbox.thelevelup.com/v15/qr_codes?preferences[color]=0&preferences[tip_percent]=10 \
  -H Accept:image/png \
  -H Content-Type:application/json \
  -H 'Authorization:token user="123897-99SCvr3kSe3TqqQid3DyPXfo2Kq98MyhF6CaNPqoDeMhJ18Uopq19uddcznu6R"'

Example Response - Image/PNG

Errors

HTTP/1.1 error 422 Unprocessable Entity - Tip was more than spend or over 100%

[
  {
    "error": {
      "message": "Payment preferences are invalid",
      "object": "qr_code",
      "property": "base"
    }
  }
]

HTTP/1.1 error 404 Not Found - User not eligible to pay or not found

HTTP/1.1 error 401 Unauthorized - User token not valid