Appearance
Idempotency
POST /checkouts requires Idempotency-Key. Use 1 to 128 characters. The key lets you retry a create after a timeout without a second checkout.
Idempotency-Key: order-1042| First request | Same key again |
|---|---|
201 Created. description is Checkout created | 200 OK. description is Duplicate request — returning existing checkout |
| A new checkout | The same checkout, with its status now |
The 200 body matches a GET of that checkout. It can already be completed.
Two identical requests at the same time still return one checkout.
Scope
The key is scoped to your account. The same string on two accounts is two keys.
MOOKHPay does not compare the new body with the first body.
A new body does not change the checkout
If you send order-1042 again with a different amount, you get the first checkout. Use one key per order. Keep that key for every retry of that order.
Pick a key
Use an id you already store for the order.
- Use the order id, such as
order-1042. Kahawa uses one value for the key and forreference. - Do not use a new random value on each attempt. Each retry would open a new checkout.
- Do not use a customer id. That value is shared by many orders.
Create the key when you create the order. Store it. Send the stored value on every retry.
Other calls
GET /checkouts/:id does not use this header.
The payer page has its own key. A second tap while a prompt is in flight returns the current attempt. It does not send a second prompt.