Hosted Checkout
How-to for merchant backends: create an order, redirect the customer, verify server-to-server, then fulfill. Amounts are integers in minor units (paisa for NPR, cents for USD). amount is tax-inclusive. JSON is camelCase. Machine-readable: /openapi.json, /llms.txt.
How it works
- Customer is ready to pay on your site.
- Your backend creates an order via
POST /api/ordersand receives acheckoutUrl. - You redirect the customer to that checkout URL.
- They pick a gateway and pay on the hosted page.
- They return to your success/failure URL with
?id=&status=(UX only;idis our order UUID). - Your backend calls
POST /api/orders/{id}/verify(or handles a signed webhook, then still verifies). - Fulfill only when
fulfilled: true.
Create → pay → verify
No SDK: any backend that can HTTPS POST works. You need a merchant account and an API key (ps_…) from Thuprai Pay.
- Create:
POST /api/orders→ storeid, redirect tocheckoutUrl. - Pay: customer completes payment on hosted checkout (you never talk to the gateway).
- Return / webhook: treat browser
?id=&status=as UX only; optional signed webhook is a hint, not proof. - Verify:
POST /api/orders/{id}/verify. Fulfill only whenfulfilled: true. Re-verify is safe.
Merchant configuration
Configure these on your merchant in Thuprai Pay. API keys and the webhook signing secret are minted there (key shown once as ps_…; secret is rotatable).
| Field | Required | Notes |
|---|---|---|
| Success / failure redirect URLs | Fallbacks when an order omits per-order redirects. If every create sends successRedirectUrl / failureRedirectUrl, these are unused for that order - any absolute URL works as placeholder. | |
| Success / failure webhook URLs | no | payment_success → success URL; payment_failed → failure URL. Same URL for both is fine; branch on event. With Awecount: also receipt_synced / exchange_fulfilled (checkout settle) on the success URL. |
| Voucher enabled + apply URL | no | Hosted checkout voucher field. When on, voucherApplyUrl is required. Same HMAC secret as webhooks. |
| Payment methods (Cash / offline / custom) | no | Names on GET /api/payment-methods for create+method and record-payment. Cash also required for return / exchange cash legs. Configure under Merchant → Payment methods (or Admin). |
API Endpoints
| Environment | Base URL |
|---|---|
| Production | https://pay.awecode.com |
| Staging | https://ps-stg.awecode.workers.dev |
Staging API keys and gateway sandbox credentials are issued in Thuprai Pay on the staging merchant (same form as production).
| Method | Path | Purpose |
|---|---|---|
POST | /api/orders | Create checkout order |
GET | /api/orders/{id} | Read order status |
POST | /api/orders/{id}/verify | Verify before fulfillment |
POST | /api/orders/{id}/cancel | Cancel open order |
POST | /api/orders/bulk-cancel | Cancel up to 5,000 open orders (per-order outcomes) |
GET | /api/payment-methods | Names you may pass as method (Cash, gateways, customs) |
POST | /api/orders/{id}/record-payment | Mark Open order paid with a method name (any offered method) |
POST | /api/orders/{id}/return | Cash sales return (credit note) |
POST | /api/orders/{id}/exchange | CN + INV + optional net settle |
Create order
Every payment starts as a server-side create. On success you get a checkoutUrl - redirect the customer there.
POST /api/ordersRequest body
{
"amount": 150000,
"tax": 0,
"shipping": 0,
"currency": "NPR",
"orderId": "1000123",
"orderNumber": "1000123",
"reference": "1000123",
"message": "Order #1000123",
"products": [
{
"name": "Seto Dharti",
"quantity": 1,
"amount": 80000,
"description": "Ebook"
}
],
"data": { "yourOrderPk": 12345 },
"tags": ["vip", "color:red"],
"gateways": ["fonepay_qr", "esewa"]
}JSON payload details
| Field | Type | Required | Notes |
|---|---|---|---|
amount | integer | yes | Minor units. Tax- and shipping-inclusive. |
currency | string | no | ISO 4217. Default NPR. |
tax / shipping | integer | no | Default 0. tax = product VAT only; shipping = incl. shipping VAT (gateway slice). Must satisfy tax + shipping <= amount. For a bill/checkout shipping row, also put it in products[]. |
orderId | string | no | Your order id. Echoed on verify / webhooks (browser return uses our id). |
reference | string | no | Unique per merchant. If omitted: {orderNumber||orderId||"order"}::{ourUuid}. Reuse → 409. |
message | string | no | Shown on checkout. |
products | array | no | Line items on checkout / the bill (name, quantity, amount = VAT-inclusive line gross). Include shipping here when it should show as its own row. Product code / category / line tax are only required when Awecount sync is on; skip that section otherwise. |
discount | integer | no | Order-level commercial discount (tax-inclusive). Payable amount is already net. Default 0. |
data | object | no | Opaque pass-through only: echoed on verify / webhooks, not shown on checkout. Typed create fields (customer, remarks, products, discount, awecountSync, …) must be top-level; values stuffed here are ignored for checkout and Awecount. |
tags | string[] | no | Dashboard labels. Immutable after create. |
gateways | string[] | no | Restrict hosted checkout by PS id (e.g. ["fonepay_qr", "esewa"]). Same ids as verify / webhook gateway. Still intersected with what you have enabled. Omit → all enabled. Ignored when method is set (create+record). See table below. |
successRedirectUrl / failureRedirectUrl | uri | no | Per-order override of merchant defaults. If set, merchant-level redirects are unused for that order. |
expiresAt | datetime | no | Optional. Must be in the future. Null = no expiry. Past → checkout refuses; status may move to Expired. |
Gateway ids
Same value on create gateways[], verify, and webhooks. Checkout UI shows the label.
| Id | Label |
|---|---|
esewa | eSewa |
khalti | Khalti |
fonepay_qr | Fonepay QR |
fonepay_bank | Fonepay Bank |
connectips | Connect IPS |
paypal | PayPal |
stripe | Stripe |
Success response
{
"id": "019f8c2a-7b1e-7000-8000-abcdef012345",
"reference": "1000123",
"checkoutUrl": "https://pay.awecode.com/xY9kQm2..."
} Redirect the customer to checkoutUrl. Store id for verify / cancel.
Get order
GET /api/orders/{id} Returns current status, latest transaction pointers, and your data / tags. Also includes refunds and refundedTotal; the original order keeps its status and payable amount (returns are recorded separately). For fulfillment, call verify - do not fulfill from get alone.
Cancel order
POST /api/orders/{id}/cancelOnly while Open. Already paid orders cannot be canceled (409).
Bulk cancel orders
POST /api/orders/bulk-cancel Cancel 1–5,000 open orders in one call. Only Open orders are canceled; duplicate ids are dropped. The batch never fails as a whole: HTTP 200 with one outcome per id, in request order.
{
"ids": [
"019f8c2a-7b1e-7000-8000-abcdef012345",
"019f8c2b-1111-7000-8000-abcdef012345",
"019f8c2c-2222-7000-8000-abcdef012345"
]
}{
"results": [
{ "id": "019f8c2a-7b1e-7000-8000-abcdef012345", "ok": true, "status": "Canceled" },
{ "id": "019f8c2b-1111-7000-8000-abcdef012345", "ok": false, "status": "Success", "error": "Order cannot be canceled (status=Success)" },
{ "id": "019f8c2c-2222-7000-8000-abcdef012345", "ok": false, "error": "Order not found" }
]
}ok: false with status → the order exists but is not Open. ok: false without status → unknown id or another merchant's order (existence never leaks). Same caveat as single cancel: a late gateway Success can still promote a Canceled order on verify.
Browser return
After payment, the customer is redirected to the order's success/failure URL (per-order override, else merchant default). Params are appended with URLSearchParams (existing ?… becomes &…, never a second ?):
?id={our order UUID}&status={Success|Failed|Canceled|Expired} Use id for POST /api/orders/{id}/verify. Order statuses: Open, Success, Failed, Canceled, Expired (American spelling).
Verify payment
Required before fulfillment. Re-checks the gateway when needed and returns whether you may fulfill.
POST /api/orders/{id}/verifySuccess response
{
"id": "019f8c2a-7b1e-7000-8000-abcdef012345",
"orderId": "1000123",
"reference": "1000123",
"amount": 150000,
"currency": "NPR",
"status": "Success",
"verified": true,
"fulfilled": true,
"verificationResult": "Success",
"transactionId": "019f8c2b-1111-7000-8000-abcdef012345",
"gateway": "esewa",
"gatewayReference": "000ABC"
}Webhooks
Optional. Set your success / failure webhook URLs and signing secret on your merchant in Thuprai Pay. Same URL for both is fine; branch on event. Still call verify before fulfillment.
payment_success→ success webhook URLpayment_failed→ failure webhook URLreceipt_synced→ success webhook URL : Awecount only (ignore if sync is off)exchange_fulfilled→ success webhook URL : checkout settle on /exchange only (amend complete; not the same aspayment_success)
Headers
Content-Type: application/json
X-Event-ID: <uuid, stable across retries>
X-Webhook-Signature: sha256=<hex HMAC of raw body> HMAC key = your webhook signing secret as UTF-8 (do not base64-decode). Respond 2xx. Use X-Event-ID as an idempotency key across retries.
Retries
Up to 6 attempts. Backoff after failure: 1m, 5m, 15m, 1h, 4h, then Exhausted.
Webhook body
{
"event": "payment_success",
"id": "019f8c2a-7b1e-7000-8000-abcdef012345",
"orderId": "1000123",
"transactionId": "019f8c2b-1111-7000-8000-abcdef012345",
"amount": 150000,
"currency": "NPR",
"status": "Success",
"gateway": "esewa",
"gatewayReference": "000ABC",
"data": { "yourOrderPk": 12345 },
"tags": ["vip", "color:red"]
}id is our order UUID (use for verify). orderId is your create-time id if set, otherwise our UUID. amount is minor units.
Vouchers
Optional. Enable vouchers and set your voucherApplyUrl on your merchant in Thuprai Pay. Hosted checkout then shows a voucher field. You own the codes; we call your URL on apply / remove.
Only one voucher at a time. To change code, remove first, then apply again. Stacking discounts is not supported.
Apply request (us → you)
POST {your voucherApplyUrl}
Content-Type: application/json
X-Webhook-Signature: sha256=<hex HMAC of raw body>{
"action": "apply",
"orderId": "019f8c2a-7b1e-7000-8000-abcdef012345",
"merchantOrderId": "1000123",
"reference": "1000123",
"checkoutToken": "xY9kQm2...",
"code": "SAVE20",
"amount": 150000,
"originalAmount": 150000,
"currency": "NPR",
"tax": 0,
"shipping": 0,
"data": { "yourOrderPk": 12345 }
}You can ignore fields you do not need. Typical use:
code- voucher to applymerchantOrderId/data- find the order in your systemoriginalAmount- create-time total (baseline for % off / min-order rules)amount- current payable (same asoriginalAmounton apply, since only one voucher is allowed)
orderId, reference, checkoutToken, tax, shipping, currency are context if you want them.
Success response (you → us)
{
"ok": true,
"amount": 120000,
"code": "SAVE20"
} Return the new payable in amount (minor units). It must be <= originalAmount. We store that as the order payable and keep the create-time total so remove can restore it.
Failure response
{
"ok": false,
"error": "invalid_code",
"detail": "Optional short message shown to the customer"
} Common error values: invalid_code, expired, already_used, not_applicable.
Remove
Same URL with "action": "remove". Reply { "ok": true }. We restore the create-time amount locally.
100% off
If apply returns amount: 0, checkout completes without a gateway: order becomes Success, we send a payment_success webhook (gateway: "voucher"), and the customer is redirected to your success URL. Still call verify and deliver only when fulfilled: true.
Errors
{
"statusCode": 409,
"statusMessage": "Order reference already exists for this merchant",
"message": "Order reference already exists for this merchant"
}Quick curl
BASE=https://pay.awecode.com
KEY=ps_...
curl -sS -X POST "$BASE/api/orders" \
-H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"amount":150000,"currency":"NPR","orderId":"1000123"}'
curl -sS "$BASE/api/orders/$ORDER_ID" -H "Authorization: Bearer $KEY"
curl -sS -X POST "$BASE/api/orders/$ORDER_ID/verify" -H "Authorization: Bearer $KEY"Security
Payment integration bugs become money bugs. Treat fulfillment as a security boundary: only your backend, only after server-to-server verify, only when fulfilled: true.
Checklist
Tick each item as you implement. Saved in this browser only.
Awecount (optional)
When sync is on, a successful payment creates an Awecount sales voucher. You never call Awecount; send the fields below on POST /api/orders; we sync the sales voucher to Awecount after the order is Success.
Payment modes
Prefer optional mode ids when your company PaymentMode names differ. Otherwise we match the mode by its exact name, and Awecount must already have a payment mode with that name.
| Payment method | Fallback Awecount name |
|---|---|
| Cash, Voucher (100% off) | Cash |
| eSewa | eSewa |
| Khalti | Khalti |
| Fonepay QR, Fonepay Bank | Fonepay |
| Connect IPS | Connect IPS |
| PayPal | PayPal |
| Stripe | Stripe |
Checkout + Awecount sync
Create without method. Sync on requires coded products and customer.name (usually also tax, remarks, discount):
POST /api/ordersRequest body
{
"amount": 55000,
"tax": 7200,
"currency": "NPR",
"orderId": "10001234",
"orderNumber": "10001234",
"message": "Table 4",
"discount": 20000,
"remarks": "Order #10001234",
"customer": {
"name": "Ram Bahadur",
"email": "ram@example.com",
"phone": "9800000000"
},
"products": [
{
"name": "Veg Biryani",
"quantity": 1,
"amount": 30000,
"discount": 5000,
"code": "FOOD-biryani-01",
"category": { "name": "Food" },
"tax": { "rate": 13 },
"description": "NPR 300 each"
},
{
"name": "General ticket",
"quantity": 1,
"amount": 50000,
"code": "TIX-general-01",
"category": { "name": "Tickets" },
"tax": { "rate": 13 },
"description": "Entry"
}
],
"data": { "yourOrderPk": 12345 },
"tags": ["store:counter"]
}- Redirect to
checkoutUrl→ customer pays. POST /api/orders/{id}/verify: redirect, webhook fulfill, and S2S verify all await Awecount before responding.- Fulfill when
fulfilled: true. Readreceiptwhenstatus: "synced".
Sync failure → HTTP 5xx. Order Success stays (money captured) but verify/redirect still error until a later verify succeeds. receipt_synced fires to your success webhook after Awecount succeeds.
receipt_synced webhook
Posted to your success webhook URL after Awecount succeeds (same HMAC as payment_success). Includes the bill number (and date / lines) for printing or display. Still call verify before fulfillment.
Webhook body
{
"event": "receipt_synced",
"orderId": "10001234",
"transactionId": "019f8c2b-1111-7000-8000-abcdef012345",
"amount": 55000,
"currency": "NPR",
"status": "Success",
"gateway": "cash",
"gatewayReference": null,
"data": { "yourOrderPk": 12345 },
"tags": ["store:counter", "tender:cash"],
"receipt": {
"billNo": "SV-1042",
"status": "synced",
"syncedAt": "2026-10-14T06:00:00.000Z",
"invoice": {
"id": 1042,
"billNo": "SV-1042",
"fiscalYear": "2082/83",
"date": "2026-10-14",
"customerName": "Ram Bahadur",
"lines": [
{
"name": "Veg Biryani",
"hsCode": null,
"quantity": 1,
"rate": 265.49,
"description": "NPR 300 each"
}
]
}
}
}Record payment
Money collected outside hosted checkout (Cash, Upaya, store QR, or a gateway offered for recording). List offered names, then create+record or record an Open order.
GET /api/payment-methods
→ { "methods": ["Cash", "Fonepay QR", "Upaya"] } Create+record (one shot, checkoutUrl: null) — method must be a list name ("Cash"; legacy "cash" on create still works):
POST /api/ordersRequest body
{
"amount": 55000,
"tax": 7200,
"currency": "NPR",
"orderId": "10001234",
"orderNumber": "10001234",
"message": "Table 4",
"discount": 20000,
"remarks": "Order #10001234",
"customer": {
"name": "Ram Bahadur",
"email": "ram@example.com",
"phone": "9800000000"
},
"products": [
{
"name": "Veg Biryani",
"quantity": 1,
"amount": 30000,
"discount": 5000,
"code": "FOOD-biryani-01",
"category": { "name": "Food" },
"tax": { "rate": 13 },
"description": "NPR 300 each"
},
{
"name": "General ticket",
"quantity": 1,
"amount": 50000,
"code": "TIX-general-01",
"category": { "name": "Tickets" },
"tax": { "rate": 13 },
"description": "Entry"
}
],
"data": { "yourOrderPk": 12345 },
"tags": ["store:counter"],
"method": "Cash"
}Success response
{
"id": "019f8c2a-7b1e-7000-8000-abcdef012345",
"orderId": "10001234",
"orderNumber": "10001234",
"reference": "10001234",
"amount": 55000,
"currency": "NPR",
"status": "Success",
"data": { "yourOrderPk": 12345 },
"tags": ["store:counter", "tender:cash"],
"customer": {
"name": "Ram Bahadur",
"email": "ram@example.com",
"phone": "9800000000"
},
"verified": true,
"fulfilled": true,
"verificationResult": "Success",
"transactionId": "019f8c2b-1111-7000-8000-abcdef012345",
"gateway": "cash",
"gatewayReference": null,
"checkoutUrl": null,
"receipt": {
"billNo": "SV-1042",
"status": "synced",
"syncedAt": "2026-10-14T06:00:00.000Z",
"invoice": {
"id": 1042,
"billNo": "SV-1042",
"fiscalYear": "2082/83",
"date": "2026-10-14",
"customerName": "Ram Bahadur",
"lines": [
{
"name": "Veg Biryani",
"hsCode": null,
"quantity": 1,
"rate": 265.49,
"description": "NPR 300 each"
},
{
"name": "General ticket",
"hsCode": null,
"quantity": 1,
"rate": 442.48,
"description": "Entry"
}
]
}
}
} Existing Open order → POST /api/orders/{id}/record-payment{ "method": "Cash" } (or "Upaya", "Fonepay QR", …). Awecount sync on → await receipt; failure → 5xx and Success reverted to Open so you can retry.
receipt.invoice.lines is the print-ready line list (not Partner rows).
Product fields (sync on)
| Field | Required | Notes |
|---|---|---|
amount | yes | Line gross, VAT-inclusive (not unit price). Same for shipping lines. |
code | yes* | Stable item code (1-64). Same SKU → same code forever. Shipping needs a code too. |
category | no | { name, hsCode? }. Omit → uncategorized. |
tax | no | { rate: 13 }. Omit → untaxed row. Use on Shipping if that line should book 13%. |
remarks / discount | no | Voucher remarks, order-level discount. |
Buyer & VAT-claimable party
Send customer on create. When sync is on, customer.name is required.
- Walk-in / B2C:
name(optional email/phone). Bill issues under that name. Buyer cannot claim input VAT. - B2B / VAT-claimable: same fields plus
taxId(Nepal PAN, 9 digits; hyphens ok; we strip non-digits). That attaches the buyer party so they can claim input VAT.
Request body (customer fragment)
{
"customer": {
"name": "Thuprai Solutions",
"email": "accounts@example.com",
"phone": "9800000000",
"taxId": "601-855-494"
}
}| Field | Required | Notes |
|---|---|---|
name | yes* | Max 120. Required when sync on. |
email | no | Max 254. |
phone | no | Max 32. |
taxId | no | 9-digit PAN. Wrong length → ignored (name-only bill). |
Opt-out & force receipt
Merchant sync is on, but this one order should skip Awecount? Send "awecountSync": false on create. Product codes and customer.name are not required, and Success will not wait on Awecount. You can still create a receipt later with the endpoint below (then both are required).
Backfill / retry after Success without a voucher (or receipt.status=failed):
POST /api/orders/{id}/receipt Body may supply products / tax / discount / customer / remarks / shipping. Payable amount is never rewritten. Already synced → returns stored receipt.
Sales return (credit note)
Cash refund against a paid order (partial or full). Needs Cash payments enabled. The original sale stays Success; we record the return separately. Works with or without Awecount:
- Sync off: no Awecount credit note; response has no
receipt. - Sync on: we also create an Awecount credit note and include its
receiptin the response (product codes required; parent receipt must already be synced).
POST /api/orders/{id}/return{id} is the original paid order id.
Request body
{
"method": "cash",
"amount": 28000,
"tax": 3212,
"discount": 0,
"reference": "019f-adjustment-uuid",
"remarks": "Return Veg Biryani",
"products": [
{
"name": "Veg Biryani",
"quantity": 1,
"amount": 28000,
"code": "FOOD-biryani-01",
"category": { "name": "Food" },
"tax": { "rate": 13 }
}
]
}| Field | Required | Notes |
|---|---|---|
method | yes | Must be "cash". |
amount / products | yes | Returned lines only. Product codes required when sync is on. |
reference | yes | Unique per merchant. Same ref + different body → 409. |
Success response
{
"id": "019f-refund-uuid",
"orderId": "019f-parent-sale-uuid",
"reference": "019f-adjustment-uuid",
"amount": 28000,
"tax": 3212,
"currency": "NPR",
"status": "Success",
"gateway": "cash",
"fulfilled": true,
"verificationResult": "Success",
"receipt": {
"billNo": "CN-88",
"status": "synced",
"syncedAt": "2026-10-14T06:00:00.000Z",
"invoice": { "id": 88, "billNo": "CN-88" }
}
} With sync off, receipt is null / omitted. Cancel does not replace a return.
Order exchange (CN + INV + net settle)
Paid-order amend: optional cash return (credit note) + optional cash sale (tax invoice at the full add amount) + optional net settle for whatever the customer still owes. Accounting bills use full line amounts; the till / QR only collects the difference.
POST /api/orders/{id}/exchangeRequest body
{
"reference": "019f-adjustment-uuid",
"remarks": "Order #48291365 adjustment",
"return": {
"amount": 28000,
"tax": 3212,
"products": [
{ "name": "Veg Biryani", "quantity": 1, "amount": 28000, "code": "FOOD-biryani-01" }
]
},
"sale": {
"amount": 30000,
"tax": 3442,
"products": [
{ "name": "Samosa (2 pc)", "quantity": 3, "amount": 30000, "code": "FOOD-samosa-01" }
]
},
"settle": {
"method": "checkout",
"successRedirectUrl": "https://pos.example/adjust?paid=1",
"failureRedirectUrl": "https://pos.example/adjust?status=Failed"
}
}When receipts post
| Case | CN / INV timing |
|---|---|
| Sync on + checkout settle + net > 0 | After settle pays. POST returns fulfilled: false and receipt: null. |
| Counter settle / net = 0 / return-only | On POST /exchange (immediate). |
| Sync off | Never: no Awecount CN/INV for the exchange. |
Checkout net > 0 with sync on: customer pays the settle checkout → we post CN then INV → exchange Fulfilled → exchange_fulfilled webhook → success redirect. Confirm the amend on fulfilled: true / that webhook, not settle payment_success alone. See Checkout settle checklist.
What settle means
We compute settleAmount = max(0, sale.amount − return.amount). Example above: return Rs 280, add Rs 300 → settle is Rs 20 (Awecount still gets CN 280 + INV 300; settle never creates a third bill).
| Net change | settleAmount | What you do |
|---|---|---|
| New total > old (customer owes more) | > 0 | Send settle. Collect the net via QR/gateway or cash at the till. |
| New total = old | 0 | Omit settle. Exchange is auto-fulfilled (fulfilled: true). |
| New total < old (customer is owed money) | 0 | Omit settle. Also auto-fulfilled. Hand the difference back at the till yourself; we do not pay out via gateway. |
settle.method and redirect URLs
| Field | When | Meaning |
|---|---|---|
method: "checkout" | Net due > 0, pay by QR / wallet / card | Opens hosted checkout for settleAmount only. Response includes checkoutUrl. |
method: "counter" | Net due > 0, already taken at till | Marks settle paid immediately (no checkout URL). |
successRedirectUrl / failureRedirectUrl | Only for checkout | Where the customer lands after paying (or failing) the net checkout. Success redirect runs only when books also succeed. Query id is checkoutOrderId from the exchange response (same role as a normal create id). Ignored for counter settle. |
Response uses exchangeId (amend) and checkoutOrderId (net-payment order; verify / receipt / cancel). Confirm the amend with exchange_fulfilled or re-POST same reference, not from the browser redirect alone.
| Leg | Awecount (sync on) | Money |
|---|---|---|
| Return | Credit note | Till handback when returning items |
| Sale | Sales voucher (cash) | Full add amount on the bill, not the QR amount |
| Settle | None | Gateway / till collects net only (when > 0) |
Success response
{
"exchangeId": "019f-exchange-uuid",
"reference": "019f-adjustment-uuid",
"parentOrderId": "019f-parent-sale-uuid",
"status": "Open",
"settleAmount": 2000,
"checkoutOrderId": "019f-checkout-uuid",
"checkoutUrl": "https://pay.awecode.com/…",
"fulfilled": false,
"return": { "id": "019f-refund-uuid", "amount": 28000, "receipt": null },
"sale": { "id": "019f-sale-uuid", "amount": 30000, "receipt": null }
} Checkout settle right after POST: receipts still null. Counter / net 0 returns fulfilled: true with receipts when sync is on.
fulfilled: truewhen settleAmount is 0, settle was cash, or settle Success and required CN/INV are synced.- Checkout settle: two webhooks on the settle order when books succeed :
payment_success(money) thenexchange_fulfilled(amend done). - Same
referenceresumes / polls; different payload →409. After expire/cancel (Failed), use a newreference.
Checkout settle checklist
Only if you use settle.method: "checkout" with net > 0. Counter / net 0 / return-only can ignore this.
- Keep the amend pending until
fulfilled: true. - Confirm via poll (re-POST same
reference) and/orexchange_fulfilled. - Do not confirm on that order’s
payment_successor the browser redirect alone (money / UX only; redirect can be spoofed). After pay + books OK the customer does land onsettle.successRedirectUrl(id=checkoutOrderId). - Unwind pending UI when settle expires or is cancelled (exchange
Failed; no CN/INV). PastexpiresAtwith a stalecheckoutUrl→ treat as expired. - After abandon/cancel, a late pay does not book the amend; keep UI unwound; start a new amend with a new
reference. - If books fail after money Success: verify/redirect return an error (no success redirect). Retry: settle verify or
POST /api/orders/{checkoutOrderId}/receipt(checkoutOrderIdfrom the exchange response).