Idempotency Key

The idempotency-key is used to safely retry operations without causing duplicate processing. It ensures that repeated requests with the same key will return the same result as the original request, preventing unintended side effects such as duplicate payments or order creation.

The logic varies depending on the endpoint and the resource’s current status, as outlined in the tables below. If a different key is used after a successful request, the system will reject the request to avoid inconsistencies or unauthorized duplication.

Preview QR

POST https://stage.api.payments.depay.us/v2/payments/previews

Status
Body
Idempotency_key
Result

CREATED

New

New

Execute operation normally.

CREATED

Same as before

Same as before

Return previous response (200 OK with previous result).

CREATED

Existing

New

Reject: order already processed with another key → possible duplicate.

WAITING_AMOUNT

New

New

Execute operation normally.

WAITING_AMOUNT

Same as before

Same as before

Return previous response (200 OK with previous result).

WAITING_AMOUNT

Existing

New

Reject: order already processed with another key → possible duplicate.

Send Amount Information to Pay a QR Code

PUT https://stage.api.payments.depay.us/v2/payments/previews

Status
Action
Ok
idempotency-key Logic

WAITING-AMOUNT

Update

Yes

Execute logic and store key

CREATED

Update

No

If idempotency-key matches -> OK (retry).

CREATED

Update with another key

No

Reject: unauthorized duplicate.

other invalid status

Update

No

Reject: invalid status.

Pay a QR Code

POST https://stage.api.payments.depay.us/v2/payments

Status
Action
Idempotency
Result

CREATED

Process payment

New

Execute action and store key.

COMPLETED

Process payment

Same

OK -> return previous response.

COMPLETED

Process payment

Different

Reject -> already processed.

CANCELED

Process payment

Any

Reject due to invalid status.

Last updated