Escrow payment provides buyer protection by holding funds in escrow until the customer confirms receipt of goods or services. This flow requires multiple API calls throughout the transaction lifecycle: payment initiation, merchant acceptance, and customer confirmation (or void/cancel if issues arise).
The escrow flow ensures that:
51051000101000100008. Standard cashier payments use a different product code and complete immediately without the acceptance/confirmation steps.The flow starts like a standard cashier payment, but uses the escrow product code.
Steps 1-18: Follow the standard cashier payment flow:
my.getAuthCodeapplyTokenpay API with escrow product codeRequest to /v1/payments/pay:
{
"productCode": "51051000101000100008",
"paymentRequestId": "escrow_order_20240101_123456",
"paymentAmount": {
"currency": "IQD",
"value": "500000"
},
"order": {
"orderDescription": "iPhone 15 Pro - Space Black",
"buyer": {
"referenceBuyerId": "216610000000003660xxxx"
}
},
"paymentNotifyUrl": "https://www.merchant.com/notify/payment",
"paymentRedirectUrl": "https://www.merchant.com/order/return"
}
Response:
{
"result": {
"resultCode": "ACCEPT",
"resultStatus": "A",
"resultMessage": "accept"
},
"paymentId": "2024010111121280010016600900000xxxx",
"redirectActionForm": {
"redirectionUrl": "https://www.wallet.com/cashier?orderId=xxxxxxx"
}
}
After payment is completed, the merchant reviews the order (checks inventory, validates delivery address, etc.) and must explicitly accept it to proceed with fulfillment.
API: POST /v1/payments/merchantAccept
Request:
{
"paymentId": "2024010111121280010016600900000xxxx"
}
Response:
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success."
}
}
cancel API.After acceptance, the merchant:
During this phase, the funds remain in escrow.
Once the customer receives and verifies the goods/services are satisfactory, they confirm receipt through the Mini Program. This releases the escrowed funds to the merchant.
API: POST /v1/payments/confirm
Request:
{
"paymentId": "2024010111121280010016600900000xxxx",
"confirmRequestId": "confirm_20240115_789012"
}
Response:
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success."
},
"confirmId": "202401151112128001016xxxx",
"confirmTime": "2024-01-15T14:30:22+03:00"
}
The escrow payment is now complete and the merchant receives the funds.
If the merchant decides not to accept the order (e.g., out of stock, cannot deliver), they can cancel the payment before calling merchantAccept. This immediately returns the full amount to the customer.
API: POST /v1/payments/cancel
Use when:
Request:
{
"paymentId": "2024010111121280010016600900000xxxx"
}
Response:
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success."
},
"paymentId": "2024010111121280010016600900000xxxx",
"cancelTime": "2024-01-01T15:20:10+03:00"
}
merchantAccept, you cannot use cancel. Use void instead.If issues arise after the merchant has accepted the order but before/during delivery, the merchant can initiate a void to return funds to the customer.
API: POST /v1/payments/void
Use when:
Full Void Request:
{
"voidRequestId": "void_20240105_345678",
"paymentId": "2024010111121280010016600900000xxxx"
}
Partial Void Request:
{
"voidRequestId": "void_20240105_345678",
"paymentId": "2024010111121280010016600900000xxxx",
"voidAmount": {
"value": "200000",
"currency": "IQD"
}
}
Response:
{
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "Success."
},
"voidRequestId": "void_20240105_345678",
"voidId": "202401051112128017xxxx"
}
If the customer already confirmed receipt but later discovers issues (defective product, wrong item, etc.), the merchant can issue a refund.
API: POST /v1/payments/refund
Use when:
Request:
{
"refundRequestId": "refund_20240120_901234",
"paymentId": "2024010111121280010016600900000xxxx",
"refundAmount": {
"value": "500000",
"currency": "IQD"
}
}
| Aspect | Standard Cashier Payment | Escrow Payment |
|---|---|---|
| Product Code | 51051000101000000011 | 51051000101000100008 |
| Fund Release | Immediate | After customer confirmation |
| Merchant Action | None required | Must call merchantAccept |
| Customer Action | None required | Must call confirm to release funds |
| Buyer Protection | Standard wallet policies | Extended protection with escrow hold |
| After Acceptance | Use refund after completion | Use void before completion, refund after |
Since escrow payments involve multiple steps, use inquiryPayment to check the current transaction status:
API: POST /v1/payments/inquiryPayment
Request:
{
"paymentId": "2024010111121280010016600900000xxxx"
}
Response includes:
paymentStatus: Current payment status (PROCESSING, SUCCESS, FAIL, etc.)transactions: Array of all transaction operations (PAY, VOID, REFUND, etc.)| resultCode | Cause | Action |
|---|---|---|
ORDER_STATUS_INVALID | Payment not completed or already accepted | Verify payment status via inquiryPayment |
ORDER_IS_MERCHANT_ACCEPTED | Already accepted | No action needed |
ORDER_NOT_EXIST | Invalid payment ID | Verify paymentId |
| resultCode | Cause | Action |
|---|---|---|
ORDER_STATUS_INVALID | Order cannot be voided in current status | Check if already voided/cancelled/confirmed |
VOID_AMOUNT_EXCEEDS_AUTH_LIMIT | Void amount exceeds payment amount | Reduce void amount |
MUTEX_OPERATION_IN_PROCESSING | Another operation in progress | Wait and retry |
ORDER_UNSUPPORTED_OPERATION | Non-escrow payment | Only escrow payments support void |
| resultCode | Cause | Action |
|---|---|---|
ORDER_STATUS_INVALID | Merchant hasn't accepted yet | Wait for merchant acceptance |
MUTEX_OPERATION_IN_PROCESSING | Void/refund in progress | Wait and retry |
ORDER_NOT_EXIST | Invalid payment ID | Verify paymentId |
| resultCode | Cause | Action |
|---|---|---|
ORDER_HAS_BEEN_CAPTURED | Already confirmed/completed | Use refund instead |
ORDER_HAS_BEEN_VOIDED | Already voided | No action needed |
CANCEL_WINDOW_EXCEED | Too late to cancel | Use void or refund |
pay - Initiate escrow paymentmerchantAccept - Accept the orderconfirm - Confirm receipt and release fundsvoid - Void payment after acceptancecancel - Cancel before acceptancerefund - Refund after completioninquiryPayment - Query payment statusmerchantAccept to ensure payment was successfulvoidRequestId, confirmRequestId) to safely retry failed operationsUNKNOWN_EXCEPTION status and poll inquiryPayment rather than assuming failure