Link Search Menu Expand Document

Patron Codes

A Patron Code is an alternative to presenting a QR code where that option isn’t available

Contents

Models

Patron Code EXPERIMENTAL

Required Fields

Field Type Description
id String The Patron Code’s unique identifier.
barcode String ✩ Field to display in barcode format.
createdAt Timestamp Date when the Patron Code was created.
createdBy String Identifier for the account that created the barcode.
expiresAt Timestamp Date when the Patron Code will expire.
appName String The app used to create the Patron Code.
accountId String The account id of the creator of the patron code

✩ Barcode is a 16 digit number. The first 6 digits are a Centrapay defined prefix, then a 9 digit code, then a luhn checksum digit.

9 9 9 0 0 0 1 2 3 4 5 6 7 8 9 5  ❖  complete barcode
9 9 9 0 0 0 - - - - - - - - - -  ❖  centrapay prefix
- - - - - - 1 2 3 4 5 6 7 8 9 -  ❖  code
- - - - - - - - - - - - - - - 5  ❖  luhn checksum

The Centrapay Prefix may present any of the following prefixes:

  • 121921
  • 123000
  • 282828
  • 293000
  • 321000
  • 321123
  • 636863
  • 713131
  • 765432
  • 777000
  • 839234
  • 848484
  • 888444
  • 929394
  • 987600
  • 999000

Operations

Creating a Patron Code EXPERIMENTAL

POST /api/patron-codes

curl -X POST https://service.centrapay.com/api/patron-codes \
  -H "Authorization: $jwt"

Example Response Payload

{
  "id": "V17FByEP9gm1shSG6a1Zzx",
  "accountId" : "Jaim1Cu1Q55uooxSens6yk",
  "barcode": "9990001234567895",
  "createdAt": "2021-06-08T22:55:00.000Z",
  "createdBy": "crn::user:1234",
  "expiresAt": "2021-06-08T23:00:00.000Z",
  "appName": "centrapay"
}

The appName field in the Patron Code represents information about the app that generated the code. It is used to apply discounts or restrict payment options for the payment request created.

You can find payment request information attached to a Patron Code by polling for the Payment Request using the transacting APIs.

Retrieving a Patron Code by id

GET /api/patron-codes/{patronCodeId}

curl https://service.centrapay.com/api/patron-codes/V17FByEP9gm1shSG6a1Zzx \
  -H "Authorization: $jwt"

Example Response Payload

{
  "id": "V17FByEP9gm1shSG6a1Zzx",
  "accountId" : "Jaim1Cu1Q55uooxSens6yk",
  "barcode": "9990001234567895",
  "createdAt": "2021-06-08T22:55:00.000Z",
  "createdBy": "crn::user:1234",
  "expiresAt": "2021-06-08T23:00:00.000Z",
  "appName": "centrapay"
}

Retrieving a Patron Code by Barcode

GET /api/patron-codes/barcode/{barcode}

curl https://service.centrapay.com/api/patron-codes/barcode/9990001234567895 \
  -H "X-Api-Key: $api_key"

Example Response Payload

{
  "id": "V17FByEP9gm1shSG6a1Zzx",
  "accountId" : "Jaim1Cu1Q55uooxSens6yk",
  "barcode": "9990001234567895",
  "createdAt": "2021-06-08T22:55:00.000Z",
  "createdBy": "crn::user:1234",
  "expiresAt": "2021-06-08T23:00:00.000Z",
  "appName": "centrapay"
}

Error Responses

Status Code Description
400 CHECKSUM_FAILED Luhn checksum digit doesn’t pass.
403 PATRON_CODE_INVALID Patron Code doesn’t exist or has has expired.