Payment Requests
Payment Requests represent the intention for a merchant to receive payment for goods and services. Payment Requests define the amount to be paid and the Asset Types that are acceptable for payment.
A Payment Request is shared with, and paid by, a patron. The Payment Flows Guide has more details regarding negotiation of Payment Requests.
Payment Requests have the following statuses:
new
: after being created.paid
: after being paid with one or more transactions.cancelled
: after being cancelled or voided by the merchant.expired
: after expiry time is reached without being paid or cancelled.
Payment requests can also be refunded for a short period of time after being paid.
Payment request state transitions can be notified to webhooks.
Centrapay Payment Requests are serviced via two sets of endpoints; the “next” version (documented on this page) and the “legacy” version (documented at Legacy Payment Requests ).
Payment Request Model
Attributes
-
id
-
shortCode
-
url
-
value
monetary -
paymentOptions
-
merchantId
-
merchantName
-
configId
-
status
-
liveness
-
createdAt
timestamp -
updatedAt
timestamp -
expiresAt
timestamp -
merchantConditions
-
remainingAmount
bignumber -
patronCodeId
-
barcode
-
barcodeType
-
collectionId
-
expirySeconds
-
lineItems
-
purchaseOrderRef
-
invoiceRef
-
redirectCancelUrl
-
redirectPaidUrl
-
externalRef
-
terminalId
-
deviceId
-
operatorId
-
createdByAccountId
-
createdByAccountName
-
conditionsEnabled
-
patronNotPresent
-
cancellationReason
-
preAuth
-
preAuthExpiresAt
timestamp -
preAuthStatus
-
taxNumber
-
partialAllowed
-
paidBy
-
basketAmount
bignumber
Payment Option Model
Attributes
-
assetType
-
amount
bignumber -
bitcoinAddress
-
acceptedCollections
⭐️ For Payment Options which specify an address, there’s a requirement to make a transaction on an external ledger. Once you have made that payment, you can use the transaction id to Pay a Payment Request using the legacy payment API.
Accepted Collections
If a Payment Request contains a centrapay.token.*
Payment Option, an array of Accepted Collections will be present inside the centrapay.token
Payment Option. The Accepted Collections returned can be used to determine if a Centrapay Token can be used to pay a Payment Request, and the Line Items able to be purchased using the Token.
Attributes
-
id
-
lineItems
Payment Condition Model
Some Asset Types require conditional approval to pay. Possible Payment Conditions include confirming proof of ID or confirming a promotional item was purchased.
The conditionsEnabled
flag should be set to true when Creating a Payment Request to indicate that Payment Conditions can be accepted. If a Payment Condition arises, the absence of the conditionsEnabled
flag will result in the Payment Request being cancelled.
Conditions can either be accepted or declined . If a condition is declined, the Payment Request will be cancelled.
Attributes
-
id
bignumber -
name
-
message
-
status
Line Item Model
An order item for which payment is requested. The currency and units for a Line Item price will be consistent with the Payment Request value and the sum of Line Item prices should equal the Payment Request value.
Line items can include a discount amount. A discount that applies to multiple Line Items may be represented as a separate Line Item with a negative amount.
Attributes
Product Classification
Attributes
-
type
-
code
-
name
-
props
Paid By Model
The Paid By provides a summary of the transactions after the Payment Request was paid.
Attributes
-
assetTotals
Asset Totals
The Asset Totals provides a sum of every transaction for each Asset Type
Payment Activity Model
A Payment Activity records a transaction that has happened on a Payment Request. Payment Activities are created when a Payment Request has been created
, paid
, refunded
, cancelled
, or expired
.
Attributes
-
id
-
type
-
value
monetary -
paymentRequestId
-
merchantId
-
merchantConfigId
-
merchantAccountId
-
merchantName
-
createdAt
timestamp -
createdBy
crn -
paymentRequestCreatedBy
crn -
activityNumber
bignumber -
shortCode
-
assetType
-
external
-
cancellationReason
-
conditionId
-
idempotencyKey
-
confirmationIdempotencyKey
-
preAuth
-
paidBy
Payment Activity Types
Name | Description |
---|---|
request | Payment Request was created. |
preAuthRequest | Payment Request was created with the preAuth flag set to "true". |
paid | Payment Request was paid. |
payment | A payment was made towards the Payment Request . |
refund | Funds were returned to the shopper. |
cancellation | Payment Request was cancelled by the merchant or the shopper. |
expiry | Payment Request wasn't paid before time out. |
accept-condition | A Payment Condition was accepted. |
decline-condition | A Payment Condition was declined. |
authorization | A Pre Auth Payment Request was approved and confirmations can be made against it. |
confirmation | Funds on a Pre Auth have been drawn down on. |
release | Pre Auth has been finalised and any remaining funds from Authorization have been returned. |
Cancellation Reasons
Reason | Description |
---|---|
CANCELLED_BY_MERCHANT | The merchant cancelled the Payment Request by calling the cancel or void endpoint. |
CANCELLED_BY_PATRON | The patron cancelled the transaction. |
PATRON_CODE_INVALID | The patron code on the Payment Request was invalid. |
PAYMENT_FAILED | The Payment Request failed for an unknown reason. |
PATRON_CODE_EXPIRED | The patron code on the Payment Request has expired. |
DECLINED_BY_PATRON | The payment was declined by the patron during approval steps. |
DECLINED_BY_MERCHANT | The payment was declined by the merchant during approval steps. |
PAYMENT_DECLINED | The payment parameters were valid but payment was declined because additional payment restrictions were violated. For example, asset not active, asset overdrawn, quota exceeded or line item category restrictions. |
PAYMENT_REQUEST_EXPIRED | The Payment Request has expired. |
NO_AVAILABLE_PAYMENT_OPTIONS | No payment options match the requested payment parameters. |
INACTIVE_ASSET | The asset used to pay the Payment Request is inactive. |
Create a Payment Request
This endpoint allows you to create a Payment Request.
Attributes
-
configId
-
barcode
-
barcodeType
-
collectionId
-
expirySeconds
-
lineItems
-
purchaseOrderRef
-
invoiceRef
-
redirectCancelUrl
-
redirectPaidUrl
-
externalRef
-
terminalId
-
deviceId
-
operatorId
-
createdByAccountName
-
conditionsEnabled
-
patronNotPresent
-
preAuth
-
partialAllowed
-
basketAmount
bignumber
Errors
-
LINE_ITEMS_SUM_CHECK_FAILED
-
CHECKSUM_FAILED
-
REDIRECT_URL_INVALID
-
PATRON_CODE_INVALID
-
NO_AVAILABLE_PAYMENT_OPTIONS
-
TOKEN_COLLECTION_NOT_FOUND
Get a Payment Request
This endpoint allows you to retrieve a Payment Request.
Get a Payment Request by Short Code
This endpoint returns the latest Payment Request that matches the given short code.
Errors
-
CHECKSUM_FAILED
Get a Payment Request linked to a Patron Code
This endpoint returns the latest Payment Request with status new
that has been attached to a Patron Code . The Payment Request may have been created with a reference to any Patron Code owned by the user's account.
This endpoint should be polled just after a user's Patron Code has been scanned. This will allow them to find the Payment Request and proceed to pay.
List Payment Requests by External Reference
This endpoint returns a list of Payment Requests that match the given external reference. Results are paginated .
Attributes
-
accountId
-
pageKey
Get Payment Request Summary
This endpoint allows you to retrieve the summary of a Payment Request while the status is new
.
Pay a Payment Request
To pay a Payment Request you must supply the name of the Asset Type and one of assetId
, transactionId
or authorization
.
- Use
assetId
if the Asset Type is managed by Centrapay. - Use
transactionId
to verify an external transaction such as a Bitcoin payment. - Use
authorization
to authorize an external transaction.
Attributes
-
assetType
-
assetId
-
transactionId
-
authorization
-
mode
-
amount
-
externalPaymentRef
Errors
-
INVALID_ASSET_TYPE
-
REQUEST_EXPIRED
-
REQUEST_PAID
-
REQUEST_CANCELLED
-
INACTIVE_ASSET
-
INVALID_MERCHANT_CONFIG
-
QUOTA_EXCEEDED
-
INSUFFICIENT_ASSET_VALUE
-
ASSET_REDEMPTION_DENIED
-
PAYMENT_DECLINED
Refund a Payment Request
This endpoint allows you to initiate a refund of a Payment Request. The refund will be completed asynchronously.
Attributes
-
externalRef
-
invoiceRef
-
confirmationIdempotencyKey
-
lineItems
-
merchantConfigId
Errors
-
LINE_ITEMS_SUM_CHECK_FAILED
-
NOT_PAID
-
ALREADY_REFUNDED
-
INVALID_AMOUNT
-
REPEAT_REFERENCE
-
PARTIAL_REFUNDS_NOT_ALLOWED
-
INACTIVE_ASSET
-
REFUND_NOT_SUPPORTED
-
REFUND_WINDOW_EXCEEDED
-
PRE_AUTH_PENDING
-
CONFIRMATION_NOT_FOUND
-
REFUND_DECLINED
Void a Payment Request
Voiding a payment request will cancel the request and trigger any refunds if necessary.
Errors
-
VOID_WINDOW_EXCEEDED
-
ALREADY_REFUNDED
-
REPEAT_REFERENCE
-
INACTIVE_ASSET
-
REFUND_NOT_SUPPORTED
-
REQUEST_EXPIRED
-
PRE_AUTH_ALREADY_CONFIRMED
Release Pre Auth funds
This endpoint allows you to release funds held for a Pre Auth Payment Request.
When you call release on a Pre Auth Payment Request any remaining funds that were being held for the authorization are returned to the asset, and a release Payment Activity is returned. If the authorization never completed, the Payment Request will instead be cancelled, and a cancellation Payment Activity will be returned.
Errors
-
INVALID_PAYMENT_REQUEST_TYPE
-
PRE_AUTH_RELEASED
Confirm Pre Auth Payment Request
This endpoint allows you to make a confirmation against a Pre Auth Payment Request.
An idempotencyKey
is a identifier from your system used for guaranteeing at least once delivery of your request. If our endpoint does not respond, you must retry until you get back a 200 or 403. If we recive 2 requests with the same idempotencyKey
, we won't process the second and return the first response.
Attributes
-
idempotencyKey
-
invoiceRef
-
lineItems
-
value
monetary
Errors
-
INVALID_PAYMENT_REQUEST_TYPE
-
PRE_AUTH_RELEASED
-
PRE_AUTH_PENDING
-
REQUEST_CANCELLED
-
INVALID_AMOUNT
-
IDEMPOTENT_OPERATION_FAILED
List Payment Activities for a Merchant
This endpoint allows you to list Payment Activities for a Merchant. Results are paginated and ordered by descending activity created date.
Attributes
-
merchantId
-
pageKey
List Payment Activities for a Payment Request
This endpoint allows you to list Payment Activities for a Payment Request. Results are ordered by descending activity created date.
Accept a Payment Condition
Accept a Payment Condition listed in merchantConditions
with status awaiting-merchant
. Returns a Payment Activity .
Errors
-
PATRON_NOT_AUTHORIZED
-
MERCHANT_NOT_AUTHORIZED
-
CONDITION_ALREADY_SET
Decline a Payment Condition
Decline a Payment Condition listed in merchantConditions
with status awaiting-merchant
. Returns a Payment Activity .
Errors
-
PATRON_NOT_AUTHORIZED
-
MERCHANT_NOT_AUTHORIZED
-
CONDITION_ALREADY_SET