Confirm a payment authorization
const url = 'https://acme.mykreezalid.com/api/v1/checkout/preauth-success';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"checkout_entity_type":"cart","checkout_entity_id":"321123","transaction_id":"123","tos_acceptance_at":"2023-09-20 10:00:00","customer_checkout_message":"example","request":"example","response":"example","note":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://acme.mykreezalid.com/api/v1/checkout/preauth-success \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "checkout_entity_type": "cart", "checkout_entity_id": "321123", "transaction_id": "123", "tos_acceptance_at": "2023-09-20 10:00:00", "customer_checkout_message": "example", "request": "example", "response": "example", "note": "example" }'Call it once your own checkout has authorized the customer’s payment. The orders are marked as paid by authorization with your active payment gateway, the cart is closed, and the checkout is recorded with your transaction identifier. Only a cart that is not closed yet, or an order still in draft, can be confirmed.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
What the customer checked out
Identifier of the cart or the order
Example
321123Identifier of the authorization at your payment provider
Example
123When the customer accepted your terms, YYYY-MM-DD HH:MM:SS
Example
2023-09-20 10:00:00Message the customer left at checkout
Accepted for compatibility; must be a string when sent
Accepted for compatibility; must be a string when sent
Accepted for compatibility; must be a string when sent
Responses
Section titled “Responses”The authorization has been recorded. The updated cart or order comes under the key cart or order, after the type you sent.
object
The updated cart, when you sent a cart
object
The updated order, when you sent an order
object
Example
{ "code": 200, "status": "success", "message": "Preauth saved and cart updated successfully"}Invalid parameters, listed in errors, or no payment gateway is active.
object
HTTP status code, repeated in the body.
object
Example
{ "code": 400, "status": "error", "message": "Some parameters are not correct", "errors": [ { "field": "tos_acceptance_at", "message": "tos_acceptance_at is not a valid date (YYYY-MM-DD HH:MM:SS)" } ]}The cart is already closed, or the order is no longer in draft.
Error body returned when the API refuses a request.
object
HTTP status code, repeated in the body.
Example
{ "code": 400, "status": "error", "message": "Some parameters are not correct"}