Payments
Authorise, then capture or cancel
Hold the funds now, decide later, and know how long you have.
Authorising holds the money without taking it. Use it when you cannot ship yet: the funds are reserved, the customer sees a pending amount, and you capture when you are ready or cancel if you never are.
authoriseOnly is the whole difference from taking the money now. The transaction comes back Authorised, not Captured.
curl -X POST "https://api.tst.au.apgpay.dev/bezel/transactions" \
-H "Authorization: Bearer $API_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"orderId": "<useOrderIdFromSeed>",
"paymentTokenId": "<usePaymentTokenIdFromSeed>",
"authoriseOnly": true,
"requestThreeDS": null,
"returnUrl": "https://bluehillcoffee.example/checkout/complete",
"offSession": null,
"cardStatementName": null,
"cardStatementCity": null,
"referenceTransactionId": "web-order-10423",
"type": "TranCmdCreate"
}'Capturing is a status change on the transaction, not a separate action verb, Captured is a state the transaction moves to. You may capture less than you authorised; you may not capture more.
curl -X PATCH "https://api.tst.au.apgpay.dev/bezel/transactions/<useTransactionIdFromStep1>" \
-H "Authorization: Bearer $API_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"captureAmount": {
"minorCurrencyUnits": 9500,
"currency": "AUD"
},
"type": "TranUpdateCapture"
}'Cancelling releases the hold. Do it as soon as you know you will not ship, the customer sees their available balance restored, and until you do they do not.
curl -X PATCH "https://api.tst.au.apgpay.dev/bezel/transactions/<useTransactionIdFromStep1>" \
-H "Authorization: Bearer $API_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "TranUpdateCancel"
}'Captured, cancelling is not available and you want refund-a-payment.See refund a payment.
