Guides
Barcode Flow for Merchants
Connecting with patrons using our Barcode Flow, also called the Quick Pay Flow, requires the patron to present a Barcode and the merchant integration to scan it in order to create a Payment Request.
Quick Pay is used to immediately complete the payment without requiring patron approval.
The patron’s barcode must be linked to an asset type that allows Quick Pay in order to use this flow. See Asset Types for the list of asset types that support Quick Pay.
sequenceDiagram
autonumber
participant Patron
participant POS
participant POS Server
participant Centrapay
Note over Patron: Present Barcode
Patron->>POS: Scan Barcode
POS->>POS Server: Request Payment
POS Server->>Centrapay: Create Payment Request with Barcode
loop Poll until final state
POS Server->>Centrapay: Get Payment Request
note over Centrapay: Confirm Details and Complete Payment
end
POS Server->>POS: Send Payment Status
Note over POS: ✅ Display Successful Payment
The patron presents a Barcode for the POS to scan.
The POS server creates a Centrapay Payment Request with the Barcode.
Request curl -X POST https://service.centrapay.com/api/payment-requests \-H "X-Api-Key: $api_key" \-H "Content-Type: application/json" \-d '{"barcode": "123456789","configId": "5ee168e8597be5002af7b454","value": {"amount": "10000","currency": "NZD"}}'Response {"barcode": "123456789","configId": "5ee168e8597be5002af7b454","createdAt": "2021-06-08T04:04:27.426Z","expiresAt": "2021-06-08T04:06:27.426Z","expirySeconds": 120,"id": "MhocUmpxxmgdHjr7DgKoKw","merchantId": "26d3Cp3rJmbMHnuNJmks2N","merchantName": "Centrapay Café","patronCodeId": "V17FByEP9gm1shSG6a1Zzx","paymentOptions": [{"amount": "10000","assetType": "paypal.main"}],"purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2","shortCode": "CP-C7F-ZS5","status": "new","updatedAt": "2021-06-08T04:04:27.426Z","url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw","value": {"currency": "NZD","amount": "10000"}}The POS server polls the Payment Request for payment completion.
Request curl https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw \-H "Authorization: $jwt"Response {"barcode": "123456789","configId": "5ee168e8597be5002af7b454","createdAt": "2021-06-08T04:04:27.426Z","expiresAt": "2021-06-08T04:06:27.426Z","expirySeconds": 120,"id": "MhocUmpxxmgdHjr7DgKoKw","merchantId": "26d3Cp3rJmbMHnuNJmks2N","merchantName": "Centrapay Café","patronCodeId": "V17FByEP9gm1shSG6a1Zzx","paymentOptions": [{"amount": "10000","assetType": "paypal.main"}],"shortCode": "CP-C7F-ZS5","status": "new","updatedAt": "2021-06-08T04:04:27.426Z","url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw","value": {"currency": "NZD","amount": "10000"}}When Centrapay receives the first attempt to poll the Payment Request, it will trigger a payment. When the Payment Request status is in a final state (
paid,cancelledorexpired). The POS server stops polling and the POS displays the result.Request curl https://service.centrapay.com/api/payment-requests/MhocUmpxxmgdHjr7DgKoKw \-H "Authorization: $jwt"Response {"barcode": "123456789","configId": "5ee168e8597be5002af7b454","createdAt": "2021-06-08T04:04:27.426Z","expiresAt": "2021-06-08T04:06:27.426Z","expirySeconds": 120,"id": "MhocUmpxxmgdHjr7DgKoKw","merchantId": "26d3Cp3rJmbMHnuNJmks2N","merchantName": "Centrapay Café","patronCodeId": "V17FByEP9gm1shSG6a1Zzx","paymentOptions": [{"amount": "10000","assetType": "paypal.main"}],"purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2","shortCode": "CP-C7F-ZS5","status": "paid","updatedAt": "2021-06-08T04:04:27.426Z","url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw","value": {"currency": "NZD","amount": "10000"}}
Checking Barcode Details
The POS server can optionally decode a scanned barcode in order to get further details about a barcode before it creates a Payment Request. For example, the POS server can use the barcode provider to apply any provider-specific discounts before creating the Payment Request.
sequenceDiagram
autonumber
participant Patron
participant POS
participant POS Server
participant Centrapay
Note over Patron: Present Barcode
Patron->>POS: Scan Barcode
POS->>POS Server: Request Barcode Details
POS Server->>Centrapay: Decode Barcode
POS Server->>POS: Send Barcode Validity
Note over POS: Apply Provider Discounts
POS->>POS Server: Request Payment
POS Server->>Centrapay: Create Payment Request with Barcode
The patron presents a barcode for the POS to scan.
The POS server decodes the scanned barcode and applies any provider-related discounts.
Request curl -X POST https://service.centrapay.com/api/decode \-H "Authorization: $jwt" \-H "Content-Type: application/json" \-d '{"code": "123456789","merchantConfigId": "5ee168e8597be5002af7b454","scannedBy": "merchant"}'Response {"code": "123456789","displayName": "PayPal","merchantConfigId": "5ee168e8597be5002af7b454","provider": "paypal","scannedBy": "merchant"}The POS server creates a Payment Request with the barcode and continues with the rest of the flow.
Request curl -X POST https://service.centrapay.com/api/payment-requests \-H "X-Api-Key: $api_key" \-H "Content-Type: application/json" \-d '{"barcode": "123456789","configId": "5ee168e8597be5002af7b454","value": {"amount": "10000","currency": "NZD"}}'Response {"barcode": "123456789","configId": "5ee168e8597be5002af7b454","createdAt": "2021-06-08T04:04:27.426Z","expiresAt": "2021-06-08T04:06:27.426Z","expirySeconds": 120,"id": "MhocUmpxxmgdHjr7DgKoKw","merchantId": "26d3Cp3rJmbMHnuNJmks2N","merchantName": "Centrapay Café","patronCodeId": "V17FByEP9gm1shSG6a1Zzx","paymentOptions": [{"amount": "10000","assetType": "paypal.main"}],"purchaseOrderRef": "oF6kj1QlH5gK0y9rjRHFh2","shortCode": "CP-C7F-ZS5","status": "new","updatedAt": "2021-06-08T04:04:27.426Z","url": "https://app.centrapay.com/pay/MhocUmpxxmgdHjr7DgKoKw","value": {"currency": "NZD","amount": "10000"}}