# Authentication & Request Signing Source: https://developer.allscale.io/api-reference/authentication HMAC-SHA256 request signing, required headers, canonical string format, and error codes. **AllScale Open API**\ **Version:** v1\ **Last updated:** 2026-01-21 *** ## Overview AllScale APIs use HMAC-SHA256 request signing to authenticate and authorize third-party requests. This mechanism provides: * Strong authentication (shared secret) * Replay-attack protection * Tamper-proof request integrity * Stateless verification * Enterprise-grade security Every API request must be signed using: * API Key * API Secret *** ## Credentials When your store or integration is created, you receive: | Field | Description | | - | - | | api\_key | Public identifier | | api\_secret | Secret key (shown once only) | Important: * The API secret is shown only once * It cannot be retrieved later * Store it securely * Treat it like a password or private key *** ## Required Request Headers | Header | Required | Description | | - | - | - | | X-API-Key | Yes | Your API key | | X-Timestamp | Yes | Unix timestamp (seconds) | | X-Nonce | Yes | Random unique string | | X-Signature | Yes | HMAC signature | *** ## Request Signing Logic ### Canonical String Format ``` METHOD PATH QUERY_STRING TIMESTAMP NONCE BODY_SHA256 ``` Joined using newline characters. ### Example ``` POST /v1/payments currency=USD 1716501000 b4d9a2a1-9c2b-4df4-8b8e-2a13a45fd321 4e07408562bedb8b60ce05c1decfe3ad16b722309a7c4c5f64b1f4e48e8d8d69 ``` *** ## Signature Algorithm Algorithm: ``` HMAC-SHA256 ``` Encoding: ``` Base64 ``` Formula: ``` signature = Base64( HMAC_SHA256(api_secret, canonical_string) ) ``` Header format: ``` X-Signature: v1= ``` *** ## JavaScript / Postman Example ```javascript theme={null} const API_KEY = pm.environment.get("API_KEY"); const API_SECRET = (pm.environment.get("API_SECRET") || "").trim(); async function hmacSha256Base64(key, msg) { const enc = new TextEncoder(); const cryptoKey = await crypto.subtle.importKey( "raw", enc.encode(key), {name: "HMAC", hash: "SHA-256"}, false, ["sign"] ); const sig = await crypto.subtle.sign("HMAC", cryptoKey, enc.encode(msg)); return btoa(String.fromCharCode(...new Uint8Array(sig))); } function sha256Hex(str) { return CryptoJS.SHA256(str).toString(CryptoJS.enc.Hex); } const method = pm.request.method.toUpperCase(); const path = pm.request.url.getPath(); const query = pm.request.url.getQueryString() || ""; const body = pm.request.body?.raw || ""; const bodyHash = sha256Hex(body); const timestamp = Math.floor(Date.now() / 1000).toString(); const nonce = crypto.randomUUID(); const canonical = [ method, path, query, timestamp, nonce, bodyHash ].join("\n"); const signature = await hmacSha256Base64(API_SECRET, canonical); pm.request.headers.upsert({key: "X-API-Key", value: API_KEY}); pm.request.headers.upsert({key: "X-Timestamp", value: timestamp}); pm.request.headers.upsert({key: "X-Nonce", value: nonce}); pm.request.headers.upsert({key: "X-Signature", value: `v1=${signature}`}); ``` *** ## Replay Protection All requests are protected using timestamp and nonce validation. Rules: * Timestamp must be within ±5 minutes * Each nonce can be used only once * Replayed requests are rejected *** ## IP Allowlist If configured, requests must originate from approved IP ranges. Examples: ``` 192.168.1.0/24 203.0.113.45/32 ``` Empty allowlist means all IPs are allowed. *** ## Error Response Format ```json theme={null} { "code": 20002, "payload": null, "error": { "message": "Bad signature", "details": { "reason": "signature_mismatch" } }, "request_id": "req_xxx" } ``` ### Error Codes | Code | Meaning | | - | - | | 20001 | Missing authentication headers | | 20002 | Invalid signature | | 30001 | Forbidden | | 40001 | Rate limit exceeded | | 90000 | Internal server error | *** ## Rate Limiting Requests may be rate-limited. Example response: ```json theme={null} { "code": 40001, "payload": null, "error": { "message": "Rate limit exceeded", "details": { "retry_after": "55 seconds" } }, "request_id": "req_xxx" } ``` *** ## Debugging Tips | Issue | Fix | | - | - | | Body mismatch | Use raw JSON | | Query mismatch | Ensure order matches | | Wrong secret | Use original secret | | Timestamp drift | Sync system clock | | Nonce reused | Generate a new one | | CryptoJS | Use Web Crypto API | *** ## Best Practices * Always use HTTPS * Use UTC timestamps * Store secrets securely * Rotate secrets regularly * Log request IDs * Never expose secrets in frontend code * Never reuse nonces *** End of document. # Create Checkout Intent Source: https://developer.allscale.io/api-reference/checkout-intents/create Create a checkout intent and receive the hosted checkout URL to redirect your buyer to. **AllScale Open API**\ **Version:** v5\ **Last updated:** 2026-10-02\ **Base Path:** `/v1/checkout_intents` *** ## Overview The Checkout Intent API allows merchants to create a checkout intent and obtain a hosted payment URL. This API is used to: * Create a checkout intent * Generate a hosted checkout URL * Price the order in either a **fiat currency** (converted to stable coin at the current FX rate) or **natively in a stable coin** (no FX, 1:1) * Receive stable-coin–based settlement *** ## Important Design Notes * All enum values are represented as **integers** in API requests and responses * API consumers must always send and receive **integer values** * **USDT** and **USDC** are supported as settlement stable coins *** ## Authentication All requests must include the following headers: | Header | Description | | - | - | | X-API-Key | API key | | X-Timestamp | Unix timestamp (seconds) | | X-Nonce | Unique request identifier | | X-Signature | HMAC signature | ### Notes * `X-Nonce` must be unique per request * `X-Timestamp` must be within allowed time window * Signature must be generated using **raw request body bytes** * Requests are protected against replay attacks *** ## POST /v1/checkout\_intents/ ### Description Create a checkout intent and return a hosted checkout URL. *** ### Request POST /v1/checkout\_intents/ #### Headers ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= Content-Type: application/json ``` #### Body Example — Fiat pricing (FX-converted) ```json theme={null} { "currency": 44, "amount_cents": 100, "order_id": "order_123", "order_description": "Monthly subscription", "user_id": "user_456", "user_name": "Tom", "redirect_url": "https://example.com/checkout/allscale", "extra": { "source": "web" } } ``` #### Body Example — Native stable-coin pricing (no FX) `amount_cents` is interpreted as stable-coin "cents": `1000` = `10.00 USDT`. `currency_rate` on the resulting intent is `null` because no FX conversion happens. ```json theme={null} { "stable_coin": 1, "amount_cents": 1000, "order_id": "order_124", "redirect_url": "https://example.com/checkout/allscale" } ``` ### Request Fields | Field | Type | Required | Description | | - | - | - | - | | currency | int \| null | ⚠️ | Fiat currency enum value (see Appendix A). **Set exactly one of `currency` or `stable_coin`.** When set, `amount_cents` is FX-converted to the stable coin at the current rate. | | stable\_coin | int \| null | ⚠️ | Stable-coin enum value (see Appendix B). **Set exactly one of `currency` or `stable_coin`.** When set, `amount_cents` is the native stable-coin amount × 100 (no FX). | | amount\_cents | int | ✅ | Amount in cents (fiat cents when `currency` is set; stable-coin cents when `stable_coin` is set — `100` = `1.00` coin) | | order\_id | string \| null | ❌ | Merchant order ID | | redirect\_url | string \| null | ❌ | URL to which the user will be redirected after payment is completed | | order\_description | string \| null | ❌ | Merchant order description | | user\_id | string \| null | ❌ | Merchant user ID | | user\_name | string \| null | ❌ | Merchant user name | | extra | object \| null | ❌ | More metadata from merchant | | accepted\_stable\_coins | list\[int] \| null | ❌ | StableCoin enum values the payer may settle in (Appendix B; e.g. `[1]` USDT-only, `[2]` USDC-only, `[1, 2]` either). When omitted, the backend falls back to the merchant's store/business setting and finally to the global default (USDT). | ⚠️ **Important** * Exactly one of `currency` or `stable_coin` must be set. Sending both, or neither, returns a `10001` validation error. * `currency` and `stable_coin` must be integer values (Appendix A / B). Do NOT pass `"USD"` or `"USDT"` strings. * For native stable-coin pricing, **USDT (`1`)** and **USDC (`2`)** are accepted. Other stable-coin enum values are reserved for future rollout and will be rejected. * The payment amount must be **greater than** 0.1 USDT / 0.1 USDC. Orders at or below this floor are rejected with a `50002` error of the form `amount must be greater than 0.1 `, where `` is the resolved settlement coin name (`USDT` or `USDC`). * **Test stores** have a lower floor: the minimum is 0.01 coin, and orders at or below 0.1 coin carry no service fee (see "Test Stores" below). * For **fiat-priced** orders that should settle in a specific stable coin, send `accepted_stable_coins` — the **first entry** picks the settlement coin used for FX conversion. Example: `"currency": 1, "accepted_stable_coins": [2]` settles a USD-priced order in USDC. Without `accepted_stable_coins` the FX target defaults to USDT (the merchant's store/business `accepted_stable_coins` setting controls only which coins the *payer* may settle in via the response bitflag — it does not influence the FX target coin). * `accepted_stable_coins` must be non-empty when provided and contain only valid StableCoin enum values; otherwise the request is rejected with `10001`. *** ### Successful Response ```json theme={null} { "code": 0, "payload": { "checkout_url": "https://checkout.allscale.io/abc123", "allscale_checkout_intent_id": "65b2f3d0d2d9c0a1b2c3d4e5", "amount_coins": "1.0000", "stable_coin_type": 1, "rate": "1.3500", "accepted_stable_coins": 1 }, "error": null, "request_id": "req_xxxxx" } ``` *** ### Response Fields | Field | Type | Description | | - | - | - | | code | int | 0 indicates success | | payload.checkout\_url | string | Hosted checkout URL | | payload.allscale\_checkout\_intent\_id | string | Checkout intent ID | | payload.amount\_coins | string | Stable coin amount | | payload.stable\_coin\_type | int | Stable coin enum value | | payload.rate | string \| null | Exchange rate | | payload.accepted\_stable\_coins | int \| null | StableCoinFlag bitmask of stablecoins the payer may settle in for this intent (`1` = USDT, `2` = USDC, `3` = either; bit `n` = StableCoin enum value `n+1`). `null` on intents created before the multi-coin rollout. | | error | object \| null | Error object | | request\_id | string | Request identifier | *** ## Possible Errors | Code | Meaning | | - | - | | 10001 | Validation error | | 20001 | Missing authentication headers | | 20002 | Invalid signature | | 30001 | Forbidden (IP not allowed) | | 40001 | Rate limit exceeded | | 50002 | Create checkout intent error (e.g. amount at or below the 0.1-coin floor) | *** ## Notes * All enum values are integers * Do not send string enum names * Nonce must be unique per request * Timestamp must be UTC * Always log `request_id` for debugging *** # Test Stores — Simulating Payment Outcomes via `currency` A **test store** (also called a sandbox store — `is_sandbox = true` in the dashboard) lets you rehearse every checkout outcome, including the ones you cannot trigger on demand in production: KYT rejection, refund, stuck settlement and forwarding failure. On a test store the `currency` field of `POST /v1/checkout_intents/` doubles as a **scenario selector**. The payer still sends real USDT to the deposit address; the outcome after the funds arrive is overridden by the currency you chose when creating the intent. **Production stores are not affected.** There `currency` is only the pricing currency and every intent follows the normal flow. ## How the override works 1. **The underpaid check runs first, for every currency.** Paying less than `amount_coins` always ends in `UNDERPAID` (-3) with an automatic refund — identical to production. 2. **A full payment is then replaced by the scenario for the currency:** | `currency` | Code | Simulated scenario | Status transitions | Final status | Webhook delivered? | | - | - | - | - | - | - | | USD | 1 | Happy path | `3 → 10 → 20` | `CONFIRMED` (20) | Yes | | CNY | 31 | **KYT rejection** — the risk score is forced over the store threshold and the full amount is refunded to the payer | `3 → 5 → -2` | `REJECTED` (-2) | No | | AUD | 9 | **KYT rejection + refund failure** — the refund transfer also fails; funds stay in the deposit wallet pending manual recovery | `3 → 5 → -1` | `FAILED` (-1) | No | | SGD | 126 | **Stuck settlement** — forwarding to the merchant wallet never completes | `3 → 4` | `PENDING_MANUAL_OPERATION` (4), **non-terminal** | No | | HKD | 57 | **Forwarding failure** — generic on-chain error before any refund is attempted | `3 → -1` | `FAILED` (-1) | No | | any other currency | — | Same as USD | `3 → 10 → 20` | `CONFIRMED` (20) | Yes | Status integers refer to the Checkout Intent Status enum (`3` TEMP\_WALLET\_RECEIVED, `4` PENDING\_MANUAL\_OPERATION, `5` SEND\_BACK, `10` ON\_CHAIN, `20` CONFIRMED, `-1` FAILED, `-2` REJECTED, `-3` UNDERPAID). ## What to verify in your integration * **One message per terminal state.** `REJECTED`, `FAILED` and `UNDERPAID` are different outcomes for your customer; do not collapse them into one generic failure. * **`PENDING_MANUAL_OPERATION` (4) is not terminal.** It does not advance on its own; AllScale operations may later complete it to `CONFIRMED`. Your poller must stop on its own timeout and must not treat `4` as a failure. * **`SEND_BACK` (5) means a refund is in flight.** Keep the order pending until `-2` or `-1` arrives. * **The webhook fires only on `CONFIRMED`.** Its payload carries `status = 20`. No webhook is sent for rejection, refund or failure, so order state for those scenarios must come from `GET /v1/checkout_intents/{checkout_intent_id}/status` or the full intent object. * **Reconciliation fields.** On the full intent, `actual_paid_amount` is populated in every scenario where funds arrived (CNY, AUD, SGD, HKD); `net_income_amount` is only meaningful on `CONFIRMED`. **Timing.** USD, CNY, AUD and HKD resolve as soon as the payment is observed on-chain. SGD reaches `PENDING_MANUAL_OPERATION` only when the stalled-payment sweep picks the intent up, about 10 minutes after the funds arrive. **Amounts.** A test store accepts orders from 0.01 coin (production requires more than 0.1), and charges no service fee on orders at or below 0.1 coin. A 0.1 USD intent is enough to exercise every scenario. Additional points before you rely on the scenario map: * **The scenario is selected by `currency` alone.** It does not depend on the store's risk-screening setting (a test store with screening off still returns `REJECTED` for CNY, because the scenario is applied before screening runs), and it applies on every chain the store accepts. * **An intent priced natively in a stable coin carries no `currency`**, so it follows the USD path. Send `currency` if you want to select a scenario. * **CNY refunds on-chain.** The refund is a real transfer back to the paying address; `SEND_BACK` (5) → `REJECTED` (-2) once it confirms. For HKD and AUD the funds stay in the intent's ephemeral wallet and are released by manual recovery, as in production. ## Other test-store differences | Area | Test store | Production | | - | - | - | | Minimum order amount | 0.01 coin | greater than 0.1 coin (`50002` below that) | | Service fee | none on orders at or below 0.1 coin | `max(0.1, amount × fee rate)` | | Webhook URL / Claim Link webhook URL | `http://` or `https://` | `https://` only | | Sepolia testnet (chain `11`) | accepted | rejected | | Risk screening | off on a new store, and not run on testnet chains | on by default | | Claim Link auto-payout | not available to test-store API keys | available once onboarded | | Store lifetime | suspended 30 days after creation; cannot be renewed | no expiry | | Number of stores | one active test store per business | no limit | Move to a production store once your integration is stable. *** # Appendix A — Currency Enum (IntEnum) | Value | Code | Currency | | -: | - | - | | 1 | USD | US Dollar | | 2 | AED | United Arab Emirates Dirham | | 3 | AFN | Afghan Afghani | | 4 | ALL | Albanian Lek | | 5 | AMD | Armenian Dram | | 6 | ANG | Netherlands Antillean Guilder | | 7 | AOA | Angolan Kwanza | | 8 | ARS | Argentine Peso | | 9 | AUD | Australian Dollar | | 10 | AWG | Aruban Florin | | 11 | AZN | Azerbaijani Manat | | 12 | BAM | Bosnia and Herzegovina Convertible Mark | | 13 | BBD | Barbadian Dollar | | 14 | BDT | Bangladeshi Taka | | 15 | BGN | Bulgarian Lev | | 16 | BHD | Bahraini Dinar | | 17 | BIF | Burundian Franc | | 18 | BMD | Bermudian Dollar | | 19 | BND | Brunei Dollar | | 20 | BOB | Bolivian Boliviano | | 21 | BRL | Brazilian Real | | 22 | BSD | Bahamian Dollar | | 23 | BTN | Bhutanese Ngultrum | | 24 | BWP | Botswanan Pula | | 25 | BYN | Belarusian Ruble | | 26 | BZD | Belize Dollar | | 27 | CAD | Canadian Dollar | | 28 | CDF | Congolese Franc | | 29 | CHF | Swiss Franc | | 30 | CLP | Chilean Peso | | 31 | CNY | Chinese Yuan | | 32 | COP | Colombian Peso | | 33 | CRC | Costa Rican Colón | | 34 | CUP | Cuban Peso | | 35 | CVE | Cape Verdean Escudo | | 36 | CZK | Czech Koruna | | 37 | DJF | Djiboutian Franc | | 38 | DKK | Danish Krone | | 39 | DOP | Dominican Peso | | 40 | DZD | Algerian Dinar | | 41 | EGP | Egyptian Pound | | 42 | ERN | Eritrean Nakfa | | 43 | ETB | Ethiopian Birr | | 44 | EUR | Euro | | 45 | FJD | Fijian Dollar | | 46 | FKP | Falkland Islands Pound | | 47 | FOK | Faroese Króna | | 48 | GBP | British Pound | | 49 | GEL | Georgian Lari | | 50 | GGP | Guernsey Pound | | 51 | GHS | Ghanaian Cedi | | 52 | GIP | Gibraltar Pound | | 53 | GMD | Gambian Dalasi | | 54 | GNF | Guinean Franc | | 55 | GTQ | Guatemalan Quetzal | | 56 | GYD | Guyanese Dollar | | 57 | HKD | Hong Kong Dollar | | 58 | HNL | Honduran Lempira | | 59 | HRK | Croatian Kuna | | 60 | HTG | Haitian Gourde | | 61 | HUF | Hungarian Forint | | 62 | IDR | Indonesian Rupiah | | 63 | ILS | Israeli New Shekel | | 64 | IMP | Isle of Man Pound | | 65 | INR | Indian Rupee | | 66 | IQD | Iraqi Dinar | | 67 | IRR | Iranian Rial | | 68 | ISK | Icelandic Króna | | 69 | JEP | Jersey Pound | | 70 | JMD | Jamaican Dollar | | 71 | JOD | Jordanian Dinar | | 72 | JPY | Japanese Yen | | 73 | KES | Kenyan Shilling | | 74 | KGS | Kyrgyzstani Som | | 75 | KHR | Cambodian Riel | | 76 | KID | Kiribati Dollar | | 77 | KMF | Comorian Franc | | 78 | KRW | South Korean Won | | 79 | KWD | Kuwaiti Dinar | | 80 | KYD | Cayman Islands Dollar | | 81 | KZT | Kazakhstani Tenge | | 82 | LAK | Lao Kip | | 83 | LBP | Lebanese Pound | | 84 | LKR | Sri Lankan Rupee | | 85 | LRD | Liberian Dollar | | 86 | LSL | Lesotho Loti | | 87 | LYD | Libyan Dinar | | 88 | MAD | Moroccan Dirham | | 89 | MDL | Moldovan Leu | | 90 | MGA | Malagasy Ariary | | 91 | MKD | Macedonian Denar | | 92 | MMK | Myanmar Kyat | | 93 | MNT | Mongolian Tögrög | | 94 | MOP | Macanese Pataca | | 95 | MRU | Mauritanian Ouguiya | | 96 | MUR | Mauritian Rupee | | 97 | MVR | Maldivian Rufiyaa | | 98 | MWK | Malawian Kwacha | | 99 | MXN | Mexican Peso | | 100 | MYR | Malaysian Ringgit | | 101 | MZN | Mozambican Metical | | 102 | NAD | Namibian Dollar | | 103 | NGN | Nigerian Naira | | 104 | NIO | Nicaraguan Córdoba | | 105 | NOK | Norwegian Krone | | 106 | NPR | Nepalese Rupee | | 107 | NZD | New Zealand Dollar | | 108 | OMR | Omani Rial | | 109 | PAB | Panamanian Balboa | | 110 | PEN | Peruvian Sol | | 111 | PGK | Papua New Guinean Kina | | 112 | PHP | Philippine Peso | | 113 | PKR | Pakistani Rupee | | 114 | PLN | Polish Złoty | | 115 | PYG | Paraguayan Guaraní | | 116 | QAR | Qatari Riyal | | 117 | RON | Romanian Leu | | 118 | RSD | Serbian Dinar | | 119 | RUB | Russian Ruble | | 120 | RWF | Rwandan Franc | | 121 | SAR | Saudi Riyal | | 122 | SBD | Solomon Islands Dollar | | 123 | SCR | Seychellois Rupee | | 124 | SDG | Sudanese Pound | | 125 | SEK | Swedish Krona | | 126 | SGD | Singapore Dollar | | 127 | SHP | Saint Helena Pound | | 128 | SLE | Sierra Leonean Leone (new) | | 129 | SLL | Sierra Leonean Leone (old) | | 130 | SOS | Somali Shilling | | 131 | SRD | Surinamese Dollar | | 132 | SSP | South Sudanese Pound | | 133 | STN | São Tomé and Príncipe Dobra | | 134 | SYP | Syrian Pound | | 135 | SZL | Swazi Lilangeni | | 136 | THB | Thai Baht | | 137 | TJS | Tajikistani Somoni | | 138 | TMT | Turkmenistani Manat | | 139 | TND | Tunisian Dinar | | 140 | TOP | Tongan Paʻanga | | 141 | TRY | Turkish Lira | | 142 | TTD | Trinidad and Tobago Dollar | | 143 | TVD | Tuvaluan Dollar | | 144 | TWD | New Taiwan Dollar | | 145 | TZS | Tanzanian Shilling | | 146 | UAH | Ukrainian Hryvnia | | 147 | UGX | Ugandan Shilling | | 148 | UYU | Uruguayan Peso | | 149 | UZS | Uzbekistani Som | | 150 | VES | Venezuelan Bolívar | | 151 | VND | Vietnamese Dong | | 152 | VUV | Vanuatu Vatu | | 153 | WST | Samoan Tālā | | 154 | XAF | Central African CFA Franc | | 155 | XCD | East Caribbean Dollar | | 156 | XCG | Caribbean Guilder | | 157 | XDR | IMF Special Drawing Rights | | 158 | XOF | West African CFA Franc | | 159 | XPF | CFP Franc | | 160 | YER | Yemeni Rial | | 161 | ZAR | South African Rand | | 162 | ZMW | Zambian Kwacha | | 163 | ZWL | Zimbabwe Dollar | *** # Appendix B — StableCoin Enum (IntEnum) | Value | Code | Name | Status | | -: | - | - | - | | 1 | USDT | Tether USD | ✅ Supported | | 2 | USDC | USD Coin | ✅ Supported | | 3 | BUSD | Binance USD | ❌ Disabled | | 4 | DAI | Dai | ❌ Disabled | | 5 | TUSD | TrueUSD | ❌ Disabled | | 6 | PAX | Pax Dollar | ❌ Disabled | | 7 | GUSD | Gemini Dollar | ❌ Disabled | | 8 | USTC | TerraClassicUSD | ❌ Disabled | | 9 | FRAX | Frax | ❌ Disabled | | 10 | EURS | Stasis Euro | ❌ Disabled | *** ✅ **Current Behavior** Successful checkout intents return `stable_coin_type` equal to the resolved settlement coin: ```json theme={null} "stable_coin_type": 1 // USDT "stable_coin_type": 2 // USDC ``` The value matches whichever supported coin was selected by the merchant via `stable_coin` (native pricing) or `accepted_stable_coins` (fiat pricing fallback order). Defaults to `1` (USDT) when neither is set. *** End of document. # Get Checkout Intent Source: https://developer.allscale.io/api-reference/checkout-intents/get Retrieve the full detail of a previously created checkout intent. **AllScale Open API**\ **Version:** v5\ **Last updated:** 2026-05-06\ **Base Path:** `/v1/checkout_intents` *** ## Overview The Checkout Intent Query API allows merchants to retrieve the **full details** of a checkout intent. This API is used to: * Fetch complete checkout intent information by `checkout_intent_id` * Display order, user, and payment details * Inspect on-chain transaction metadata after payment * Debug or reconcile payment lifecycle issues *** ## Important Notes * All enum values are represented as **integers** in API requests and responses * Monetary values involving stable coins are returned as **strings** to preserve precision * This endpoint returns a **structured object** in `payload` * Permission checks are enforced at the **store/business** level *** ## Authentication All requests must include the following headers: | Header | Description | | - | - | | X-API-Key | API key | | X-Timestamp | Unix timestamp (seconds) | | X-Nonce | Unique request identifier | | X-Signature | HMAC signature | ### Notes * `X-Nonce` must be unique per request * `X-Timestamp` must be within the allowed time window * Signature must be generated using **raw request body bytes** * Requests are protected against replay attacks *** ## GET /v1/checkout\_intents/ ### Description Retrieve the full checkout intent object, including payment configuration, order metadata, and on-chain transaction details (if available). *** ### Request ``` GET /v1/checkout_intents/{checkout_intent_id} ``` #### Path Parameters | Parameter | Type | Required | Description | | - | - | -: | - | | checkout\_intent\_id | string | ✅ | AllScale checkout intent ObjectId string | #### Headers ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= ``` > Note: This is a GET request, so there is no request body. *** ## Successful Response ```json theme={null} { "code": 0, "payload": { "all_scale_checkout_intent_id": "65c9d4e5a9f4e0d2b6a1e123", "currency": 1, "currency_symbol": "USD", "amount_cents": 2500, "chain_id": 1, "amount_coins": "2.500000", "coin_symbol": "USDT", "coin_contract": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "currency_rate": "1.000000", "status": 20, "order_id": "order_8899", "order_description": "Premium subscription", "user_id": "user_001", "user_name": "Alice", "tx_hash": "0xabc123...", "tx_from": "0xSenderAddress", "tx_to": "0xReceiverAddress", "payment_method_type": 1, "actual_paid_amount": "2.500000", "net_income_amount": "2.400000", "service_fee_amount": "0.100000", "accepted_stable_coins": 1 }, "error": null, "request_id": "req_xxxxx" } ``` *** ## Response Fields ### Top-Level Fields | Field | Type | Description | | - | - | - | | code | int | 0 indicates success | | payload | object | Checkout intent object | | error | object \| null | Error object | | request\_id | string | Request identifier | *** ### Payload — Checkout Intent Object | Field | Type | Description | | - | - | - | | all\_scale\_checkout\_intent\_id | string | Checkout intent ID | | currency | int \| null | Fiat currency enum value. `null` when the intent was priced natively in a stable coin. | | currency\_symbol | string \| null | Fiat currency symbol (e.g. USD). `null` when the intent was priced natively in a stable coin. | | amount\_cents | int \| null | Amount in fiat cents. `null` when the intent was priced natively in a stable coin — the authoritative amount is `amount_coins`. | | chain\_id | int \| null | EIP-155 chain ID | | amount\_coins | string | Amount in stable coin | | coin\_symbol | string | Stable coin symbol (USDT / USDC) | | coin\_contract | string \| null | Stable coin contract address | | currency\_rate | string \| null | Fiat → stable coin conversion rate. `null` when the intent was priced natively in a stable coin (no FX occurred). | | status | int | Checkout intent status enum value | | order\_id | string \| null | Merchant order ID | | order\_description | string \| null | Merchant order description | | user\_id | string \| null | Merchant user ID | | user\_name | string \| null | Merchant user name | | error\_message | string \| null | Error message (if failed) | | tx\_hash | string \| null | On-chain transaction hash from the customer's wallet to the ephemeral wallet | | tx\_hash\_2 | string \| null | On-chain transaction hash of the second transfer, from the ephemeral wallet to the merchant's wallet | | tx\_from | string \| null | Customer's wallet address | | tx\_to | string | Merchant's AllScale wallet address | | actual\_paid\_amount | string \| null | Actual stablecoin amount paid by the user | | service\_fee\_amount | string \| null | AllScale service fee deducted from the payment amount | | net\_income\_amount | string \| null | Net stablecoin amount credited to the merchant. Calculated as `actual_paid_amount - service_fee_amount`. | | payment\_method\_type | integer | Payment method type used for this transaction. Value must correspond to the `PaymentMethodType` enum: `0=UNKNOWN`, `1=WALLET_SCAN`, `2=WALLET_CONNECT`, `3=ALL_SCALE_PAY`. | | accepted\_stable\_coins | int \| null | StableCoinFlag bitmask of stablecoins the payer may settle in for this intent (`1` = USDT, `2` = USDC, `3` = either; bit `n` = StableCoin enum value `n+1`). `null` on intents created before the multi-coin rollout. | *** ## Possible Errors | Code | Meaning | | - | - | | 10001 | Validation error | | 20001 | Missing authentication headers | | 20002 | Invalid signature | | 30001 | Forbidden (no permission to view this checkout intent) | | 40001 | Rate limit exceeded | | 50001 | Checkout intent not found | | 90000 | Internal server error, pls contact us | | 99999 | Unknown error, pls contact us | *** ## Notes * This endpoint enforces **store/business ownership** checks * Enum fields (such as `currency` and `status`) are returned as **integers only** * Decimal values are returned as **strings** to avoid precision loss * Always log `request_id` when debugging production issues * If you only need the status value, prefer\ `GET /v1/checkout_intents/{checkout_intent_id}/status` for lower payload size *** ## Related APIs * `POST /v1/checkout_intents` * `GET /v1/checkout_intents/{checkout_intent_id}/status` *** # Appendix — Checkout Intent Status Enum | **Value** | **Name** | **Meaning** | **Terminal** | | - | - | - | - | | -1 | FAILED | Checkout failed due to internal or processing error | ✅ | | -2 | REJECTED | Rejected by KYT (Know Your Transaction) checks | ✅ | | -3 | UNDERPAID | Paid amount is less than required | ✅ | | -4 | CANCELED | User manually canceled the checkout | ✅ | | -5 | TIMEOUT | Checkout expired due to inactivity or time limit | ✅ | | 1 | CREATED | Checkout intent created, not yet viewed by user | ❌ | | 2 | VIEWED | Hosted checkout page has been opened by the user | ❌ | | 3 | TEMP\_WALLET\_RECEIVED | Temporary deposit wallet assigned (KYT flow only) | ❌ | | 4 | MANUAL\_OPERATION | Stuck in TEMP\_WALLET\_RECEIVED; pending manual review | ❌ | | 5 | SEND\_BACK | Refund in progress back to payer (KYT or underpaid) | ❌ | | 10 | ON\_CHAIN | On-chain transaction detected, awaiting confirmation | ❌ | | 20 | CONFIRMED | Payment confirmed successfully on-chain | ✅ | *** End of document. # Get Checkout Intent Status Source: https://developer.allscale.io/api-reference/checkout-intents/get-status Poll the lightweight status endpoint for a checkout intent. **AllScale Open API**\ **Version:** v3\ **Last updated:** 2026-10-02\ **Base Path:** `/v1/checkout_intents` *** ## Overview The Checkout Intent Status API allows merchants to query the **current status** of a checkout intent. This API is used to: * Retrieve the checkout intent status by `checkout_intent_id` * Poll status after creating a checkout intent and redirecting users to hosted checkout *** ## Important Design Notes * All enum values are represented as **integers** in API requests and responses * API consumers must always send and receive **integer values** * This endpoint returns **only** the status integer (in `payload`) *** ## Authentication All requests must include the following headers: | Header | Description | | - | - | | X-API-Key | API key | | X-Timestamp | Unix timestamp (seconds) | | X-Nonce | Unique request identifier | | X-Signature | HMAC signature | ### Notes * `X-Nonce` must be unique per request * `X-Timestamp` must be within allowed time window * Signature must be generated using **raw request body bytes** * Requests are protected against replay attacks *** ## GET /v1/checkout\_intents//status ### Description Get the checkout intent status as an integer. *** ### Request GET /v1/checkout\_intents//status #### Path Parameters | Parameter | Type | Required | Description | | - | - | -: | - | | checkout\_intent\_id | string | ✅ | AllScale checkout intent ObjectId string | #### Headers ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= ``` > Note: This is a GET request, so there is no request body. *** ### Successful Response ```json theme={null} { "code": 0, "payload": 2, "error": null, "request_id": "req_xxxxx" } ``` * `payload` is the **checkout intent status integer**. *** ### Response Fields | Field | Type | Description | | - | - | - | | code | int | 0 indicates success | | payload | int | Checkout intent status enum value | | error | object \| null | Error object | | request\_id | string | Request identifier | *** ## Possible Errors | Code | Meaning | | - | - | | 10001 | Validation error | | 20001 | Missing authentication headers | | 20002 | Invalid signature | | 30001 | Forbidden (no permission to view this checkout intent) | | 40001 | Rate limit exceeded | | 50001 | Checkout intent not found | | 90000 | Internal server error, pls contact us | | 99999 | Unknown error, pls contact us | *** ## Notes * This endpoint enforces permission checks: the checkout intent must belong to the authenticated store/business context. * Always log `request_id` for debugging. * Since `payload` is an int, do not expect `payload.status` or other nested fields. * On a **test store**, the `currency` chosen at creation selects the outcome (CNY → `REJECTED`, AUD / HKD → `FAILED`, SGD → `PENDING_MANUAL_OPERATION`, which is non-terminal). See "Test Stores — Simulating Payment Outcomes" in the Create Checkout Intent doc. *** # Appendix — Checkout Intent Status Enum | **Value** | **Name** | **Meaning** | **Terminal** | | - | - | - | - | | -1 | FAILED | Checkout failed due to internal or processing error | ✅ | | -2 | REJECTED | Rejected by KYT (Know Your Transaction) checks | ✅ | | -3 | UNDERPAID | Paid amount is less than required | ✅ | | -4 | CANCELED | User manually canceled the checkout | ✅ | | -5 | TIMEOUT | Checkout expired due to inactivity or time limit | ✅ | | 1 | CREATED | Checkout intent created, not yet viewed by user | ❌ | | 2 | VIEWED | Hosted checkout page has been opened by the user | ❌ | | 3 | TEMP\_WALLET\_RECEIVED | Temporary deposit wallet assigned (KYT flow only) | ❌ | | 4 | MANUAL\_OPERATION | Stuck in TEMP\_WALLET\_RECEIVED; pending manual review | ❌ | | 5 | SEND\_BACK | Refund in progress back to payer (KYT or underpaid) | ❌ | | 10 | ON\_CHAIN | On-chain transaction detected, awaiting confirmation | ❌ | | 20 | CONFIRMED | Payment confirmed successfully on-chain | ✅ | *** End of document. # Cancel Auto-Payout Source: https://developer.allscale.io/api-reference/claim-links/cancel-auto-payout Claim back an unclaimed auto-payout and return the funds to your balance. **AllScale Open API**\ **Version:** v1\ **Last updated:** 2026-07-15\ **Base Path:** `/v1/claim_link_auto_payouts` *** ## Overview The Claim Link Cancel API lets a merchant **claim back a funded link that has not been claimed yet**. The link is closed immediately and the funded amount is returned to you. Use this endpoint to: * Cancel a payout you sent by mistake, or to the wrong recipient * Close a link the recipient never claimed, without waiting out the 14-day expiry * Get the funds back automatically — the refund is settled by AllScale, you do not send anything on-chain > Cancelling is **only** possible while the link is **funded and unclaimed**. Once a recipient has started claiming, the link can no longer be cancelled — see [Cancellable states](#cancellable-states). The call is **fast and synchronous**: it flips the link to `cancelled` and returns immediately. The **refund is settled off the request path** — it does *not* block on an on-chain receipt. You are notified when the refund actually lands via the [`cancelled` webhook](/webhooks/claim-link-webhook). *** ## Availability & Prerequisites This endpoint is **per-merchant authorized**. It returns `50104` (HTTP 403) or `30002` (HTTP 403) unless **both** of the following hold: 1. Your API key is a **production (non-sandbox)** key. Sandbox keys are rejected — a cancel moves real funds. 2. Your store has been granted the **`claim_link:auto_payout`** scope (the same scope as create). The `*` wildcard scope does **not** grant it. > **Unlike create, cancel is *not* gated by `CLAIM_LINK_LIVE_SIGNING_ENABLED`.** Cancel never signs or broadcasts a transaction inside the request, so it stays available even where live signing is off — you can always claim a funded link back. *** ## Important Design Notes * The cancel is **synchronous**, but the **refund is asynchronous**. A `200` means "the link is closed and the refund is scheduled", **not** "the money is back". * The refund is settled by the same money-safe reconciliation path that drives expiry refunds, and is returned to your business wallet. * **Not a toggle.** `cancelled` is a **terminal** state — a cancelled link can never be re-opened or claimed. A recipient who opens a cancelled link is refused. * **Cancel is not retry-idempotent.** A second cancel of an already-cancelled link returns `50108` (HTTP 409), not another `200`. Treat `50108` with `status: "cancelled"` as "already done", not as a failure. *** ## Authentication All requests must include the following headers (see the **Auth** doc for the full canonical-request + signing scheme): | Header | Description | | - | - | | X-API-Key | API key | | X-Timestamp | Unix timestamp (seconds) | | X-Nonce | Unique request identifier | | X-Signature | HMAC signature `v1=` | ### Notes * `X-Nonce` must be unique per request; `X-Timestamp` must be within the allowed window. * The signature is computed over the **raw request body bytes**. This endpoint sends **no body**, so the body hash is that of the **empty string**. * Requests are protected against replay attacks. *** ## POST /v1/claim\_link\_auto\_payouts//cancel ### Description Cancel (claim back) one of **your own** funded, unclaimed claim links. Flips the link to `cancelled` and schedules the refund of the funded amount back to you. *** ### Request `POST /v1/claim_link_auto_payouts/{claim_link_id}/cancel` #### Path Parameters | Parameter | Type | Required | Description | | - | - | - | - | | claim\_link\_id | string | ✅ | The AllScale claim link id returned by the create call (`payload.claim_link_id`). | #### Headers ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= ``` #### Body **None.** This endpoint takes no request body — the link is identified entirely by the path parameter. *** ### Cancellable states A link can be cancelled **only** when it is **funded, unclaimed, and yours**. A link that is not yours (or an unknown id) returns `50107` (HTTP 404); an owned but non-cancellable link returns `50108` (HTTP 409) with the current `status` and a `reason`. | Link state | Cancellable | Why | | - | - | - | | `link_sent` | ✅ **Yes** | Funded and awaiting the recipient — this is the cancellable state. | | `pending_deposit` | ❌ No | Not funded yet. It may hold a partial / in-flight deposit, so there is no safe amount to refund. An unfunded link expires on its own. | | `claiming` | ❌ No | The recipient has already started claiming and the payout may already be broadcast. Cancelling here could **double-pay**, so it is locked. | | `claimed` | ❌ No | Terminal — the recipient already got the funds. | | `expired` | ❌ No | Terminal — already refunded to you via expiry. | | `cancelled` | ❌ No | Terminal — already cancelled (a repeat cancel returns `50108`). | | Batch sub-links | ❌ No | A batch link's funds are pooled and must be returned through the batch's aggregate refund flow, not one link at a time. | *** ### Successful Response ```json theme={null} { "code": 0, "payload": { "claim_link_id": "665b2f3d0d2d9c0a1b2c3d4e", "reference_id": "payout_2026_07_0001", "status": "cancelled", "refund_status": "refund_pending" }, "error": null, "request_id": "req_xxxxx" } ``` #### Response Fields | Field | Type | Description | | - | - | - | | code | int | `0` indicates success. | | payload.claim\_link\_id | string | AllScale claim link id. | | payload.reference\_id | string \| null | Your reference id, echoed back; `null` if the link was created without one. | | payload.status | string | Always `"cancelled"` on success. The link is now terminal and can never be claimed. | | payload.refund\_status | string | Always `"refund_pending"` on success — the refund is **scheduled**, not yet settled. Wait for the `cancelled` webhook for settlement. | | error | object \| null | Error object (`null` on success). | | request\_id | string | Request identifier (echo it in support requests). | *** ### Error Response — not cancellable (`50108`) When the link is yours but is not in a cancellable state, the `details` carry the link's current `status` and a human-readable `reason` so you can branch precisely: ```json theme={null} { "code": 50108, "payload": null, "error": { "message": "Claim link cannot be cancelled in its current state.", "details": { "status": "claiming", "reason": "the link is being claimed and can no longer be cancelled" } }, "request_id": "req_xxxxx" } ``` *** ## Possible Errors | Code | HTTP | Meaning | | - | - | - | | 10001 | 400 | Validation error. | | 20001 | 401 | Missing authentication headers. | | 20002 | 401 | Invalid signature. | | 30001 | 403 | Forbidden (client IP not in the store allowlist). | | 30002 | 403 | Scope forbidden — the store lacks the `claim_link:auto_payout` scope. | | 40001 | 429 | Rate limit exceeded. | | 50104 | 403 | A **sandbox** API key was used. Cancel moves real funds and is production-key only. | | 50107 | 404 | Claim link not found — unknown id, a malformed id, **or a link belonging to another business**. All three return the same response by design (the id space cannot be probed). | | 50108 | 409 | Not cancellable in the current state — `pending_deposit` / `claiming` / already terminal / a batch sub-link. See `error.details.status` and `error.details.reason`. | > This table lists the errors specific to this endpoint. Unexpected server-side failures may return a generic platform error code (e.g. `90000` / `99999`) with HTTP 500 — treat **any** non-zero `code` as a failure and surface `error` + `request_id` for support. *** ## Settlement — how you know the money is back A `200` from this endpoint means the link is **closed**, not that the refund has landed. There are two ways the refund settles: 1. **`cancelled` webhook (recommended).** When the refund succeeds on-chain, AllScale POSTs a `cancelled` terminal event to your store's `claim_link_webhook_url`, carrying the `refund_tx_hash`. See the [Claim Link Webhook doc](/webhooks/claim-link-webhook). 2. **Reconciliation.** If you have no webhook URL configured (or missed the delivery window), reconcile against your wallet balance / the link's status. ⚠️ **The `cancelled` webhook is only emitted for links created through the auto-payout API** (`POST /v1/claim_link_auto_payouts`) — those links carry your store id, which is what the callback is addressed to. This endpoint is business-scoped, so it can also cancel a link your team created **in the AllScale app/dashboard**; such a link emits **no** webhook at all (by design — in-app links never do). The cancel itself works identically; only the callback is absent, so reconcile those manually. The refund lands within the reconciliation window under normal conditions. If a refund cannot be confirmed, AllScale holds the funds and pages on-call rather than re-sending — funds are never double-refunded. *** ## Notes * **Cancel only what you own.** A link created by another business returns `50107`, exactly as an unknown id does — this is deliberate, so the endpoint cannot be used to discover other merchants' link ids. * **Race with the recipient.** Between your read and your cancel, the recipient may start claiming. That is the `50108` / `status: "claiming"` case — the recipient wins, and the claim proceeds. This is intended: money-safety beats cancel-wins. * **Refund amount.** You are refunded the funded amount less network/service fees already settled at funding time. An accidental overpayment at funding is returned too. * **Cancelled links are dead.** The claim URL and bearer token for a cancelled link are permanently unusable; a recipient opening it is refused. # Create Auto-Payout Source: https://developer.allscale.io/api-reference/claim-links/create-auto-payout Send funds to a recipient through an AllScale claim link. **AllScale Open API**\ **Version:** v1\ **Last updated:** 2026-07-21\ **Base Path:** `/v1/claim_link_auto_payouts` *** ## Overview The Claim Link Auto-Payout API lets a merchant create a **single claim link and fund it automatically in one call** — no on-chain deposit step for the merchant. AllScale creates the link, then funds its pool wallet from the merchant's own custodied (Turnkey) wallet using a small-amount **passwordless** signing session, and returns the bearer claim URL. Use this endpoint to: * Create one claim link for a recipient (payout / disbursement) * Have AllScale fund it automatically from your custodied wallet (no manual deposit) * Get back a shareable **claim URL** (and the one-time bearer `token`) to deliver to the recipient * Make the call **idempotent** with a `reference_id` (**always required**) > The recipient later opens the claim URL to claim the funds. For the sender-funded flow where you deposit on-chain yourself, see the standard claim-link create (dashboard/GraphQL) or the Batch API. *** ## Availability & Prerequisites This endpoint is **deploy-flag gated** and **per-merchant authorized**. All of the following must hold (1–2 fail with `50104`, 3 fails with `30002` — both HTTP 403): 1. **Live signing is enabled** on the environment (`CLAIM_LINK_LIVE_SIGNING_ENABLED`). It is enabled on **gamma (staging)** and gated off on production until launch. 2. Your API key is a **production (non-sandbox)** key. Sandbox keys are rejected. 3. Your store has been granted the **`claim_link:auto_payout`** scope. This scope is provisioned only after your business completes the auto-payout **onboarding** (creating a Turnkey session user + amount-limit policy). The `*` wildcard scope does **not** grant it. Funding is capped per session by the amount-limit policy set during onboarding; a request over the cap is rejected by the signing policy. *** ## Important Design Notes * All enum values (`stable_coin`, `chain`) are **integers** in requests and responses. * `amount` is sent and returned as a **string** to preserve exact decimal precision — never a JSON number. * Settlement stable coins: **USDT (`1`)** and **USDC (`2`)**. * Chains: **EVM chains only** — Ethereum (`1`), Base (`5`), BNB (`6`), Arbitrum (`7`), Polygon (`8`), Optimism (`9`); Sepolia testnet (`11`) is additionally accepted on test environments. * The call is **synchronous**: it creates the link and blocks until the funding transaction settles (≈ up to \~90s), then returns the funded link. *** ## Authentication All requests must include the following headers (see the **Auth** doc for the full canonical-request + signing scheme): | Header | Description | | - | - | | X-API-Key | API key | | X-Timestamp | Unix timestamp (seconds) | | X-Nonce | Unique request identifier | | X-Signature | HMAC signature `v1=` | ### Notes * `X-Nonce` must be unique per request; `X-Timestamp` must be within the allowed window. * The signature is computed over the **raw request body bytes**. * Requests are protected against replay attacks. *** ## POST /v1/claim\_link\_auto\_payouts ### Description Create a claim link and auto-fund it from the merchant's custodied wallet. Returns the created (and funded) link, including the bearer claim URL. *** ### Request `POST /v1/claim_link_auto_payouts` #### Headers ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= Content-Type: application/json ``` #### Body Example ```json theme={null} { "amount": "10.50", "stable_coin": 1, "chain": 5, "receiver_email": "recipient@example.com", "sender_display_name": "Acme Payouts", "sender_message": "Your July payout", "reference_id": "payout_2026_07_0001" } ``` #### Request Fields | Field | Type | Required | Description | | - | - | - | - | | amount | string | ✅ | The recipient's claimable amount in **token units** (e.g. `"10.50"` = 10.50 USDT). Must be a finite, positive decimal and no finer than the token's on-chain decimals. | | stable\_coin | int | ✅ | Stable coin enum: `1` = USDT, `2` = USDC. | | chain | int | ✅ | Chain enum (EVM only): `1` ETH, `5` Base, `6` BNB, `7` Arbitrum, `8` Polygon, `9` Optimism. | | receiver\_email | string \| null | ❌ | Recorded on the link so the sender can see who it was meant for. **AllScale does not email the recipient** — you deliver the `claim_url` yourself. Max 254 chars. | | sender\_display\_name | string \| null | ❌ | Shown to the recipient as the sender. Max 100 chars. | | sender\_message | string \| null | ❌ | A short note shown to the recipient. Max 500 chars. | | reference\_id | string | ✅ | Your idempotency key. 1–128 printable ASCII (no spaces/control chars). **Always required** — a missing or blank value is rejected with `10001`. Re-sending the **same** `reference_id` returns the original link instead of creating a new one. | ⚠️ **Important** * `amount` must be **> 0** and match the token's on-chain precision **for the selected chain** (e.g. USDT/USDC allow 6 decimals on most chains, but 18 on BNB). An over-precise amount is rejected with `10001`. * `stable_coin` and `chain` are **integers**, not strings (`"USDT"` / `"BASE"` will be rejected). * `reference_id` is **always required** — it is the idempotency key that makes retries safe, and there is no opt-out. Because this call is **synchronous** (it blocks up to \~90s for the funding receipt), a client timeout + retry is the likeliest failure path, and the stable `reference_id` is exactly what stops that retry creating a **second** link and a **second** debit. A missing or blank `reference_id` is rejected with `10001`. *** ### Successful Response ```json theme={null} { "code": 0, "payload": { "claim_link_id": "665b2f3d0d2d9c0a1b2c3d4e", "reference_id": "payout_2026_07_0001", "amount": "10.50", "token_symbol": "USDT", "chain_id": 8453, "status": "pending_deposit", "token": "clk_live_9f8a...c1", "claim_url": "https://claim.allscale.io/clk_live_9f8a...c1", "funding_tx_hash": "0xabc...def", "funded_amount": "10.50", "idempotent_hit": false }, "error": null, "request_id": "req_xxxxx" } ``` #### Response Fields | Field | Type | Description | | - | - | - | | code | int | `0` indicates success. | | payload.claim\_link\_id | string | AllScale claim link id. | | payload.reference\_id | string \| null | Your reference id, echoed back. | | payload.amount | string | The claimable amount (token units). | | payload.token\_symbol | string | Stable coin symbol, e.g. `USDT`. | | payload.chain\_id | int | EIP-155 chain id of the funding/payout chain (e.g. `8453` for Base). | | payload.status | string | Link lifecycle status. After a successful auto-fund the link is funding-confirmed by the scanner shortly after. | | payload.token | string \| null | **Bearer claim token — returned once; treat as a secret.** Anyone with it can claim. **Always `null` on an idempotent replay** (as are `funding_tx_hash` and `funded_amount`); only `claim_url` is rebuilt. | | payload.claim\_url | string \| null | The shareable claim URL to deliver to the recipient (rebuilt from the token). | | payload.funding\_tx\_hash | string \| null | The on-chain funding transaction hash (present when this call funded the link). | | payload.funded\_amount | string \| null | The **principal** amount (USD-normalized) funded into the pool wallet by this call. Fees are settled separately and are **not** included here. `null` on an idempotent replay. | | payload.idempotent\_hit | bool | `true` when this call matched a prior `reference_id` and returned the existing link instead of creating a new one. | | error | object \| null | Error object (`null` on success). | | request\_id | string | Request identifier (echo it in support requests). | *** ### Error Response — funding/signing failure (`50103`) A create that fails at the funding stage returns `50103`, and `error.details` carries the underlying AllScale code (`plutus_code`) plus a human-readable `reason` telling you what to do next: ```json theme={null} { "code": 50103, "payload": null, "error": { "message": "Claim link auto-payout create failed.", "details": { "reason": "The auto-payout authorization session has expired. Please re-authorize the merchant auto-payout session and retry.", "reason_code": "session_expired", "plutus_code": 8148 } }, "request_id": "req_xxxxx" } ``` **`plutus_code: 8148` — the payout could not be signed.** No funds moved: 8148 is always raised *before* broadcast, and the reserved budget is released, so your used-percentage is unaffected. All 8148s share the one code — the machine-readable **`reason_code`** tells the three cases apart: | `reason_code` | What happened | What to do | | - | - | - | | `session_expired` | Your auto-payout session lapsed, or none is provisioned. | Re-authorize the merchant auto-payout session, then retry. | | `policy_denied` | Your wallet policy declined the signature. | Check the request against the policy's limits (including the per-transaction amount ceiling) and that the policy is still verified for this wallet; re-authorize the policy if needed, then retry. | | `signer_error` | A temporary signer/infrastructure fault, or an authorization that completed concurrently. | Retry with the **same `reference_id`**. Contact support if it persists. | > **A policy rejection does not necessarily mean the amount was too high.** The wallet policy checks > several things at once — the chain and verifying contract, the token, the sponsor, **and** the > per-transaction amount ceiling — and the signer reports one rejected result without saying which > check failed. So lowering the amount will not help if some other part of the policy was the cause; > re-verify the policy as well. > **Retrying an 8148 is safe.** Nothing was signed or broadcast and the budget reservation is > released, so re-sending the request with the **same `reference_id`** cannot double-pay: the > endpoint is idempotent per `(business, store, reference_id)` and `reference_id` is always > required. Always retry with the original `reference_id` — never mint a new one for a retry, which > would be a genuinely new payout. > `reason` is human-readable guidance and its **exact wording may change** — do not match on the > literal string. Branch on `code` / `plutus_code` / **`reason_code`** (a stable machine-readable > category: `session_expired`, `policy_denied`, or `signer_error`), and surface `reason` (plus > `request_id`) to whoever operates the integration. `reason_code` is present only when the failure > maps to one of these categories. *** ## Possible Errors | Code | HTTP | Meaning | | - | - | - | | 10001 | 400 / 422 | Validation error — missing/invalid `amount`, over-precision, missing/blank `reference_id` (always required), bad `reference_id`, or unsupported coin. Malformed JSON or wrong field types are returned as **422**. | | 20001 | 401 | Missing authentication headers. | | 20002 | 401 | Invalid signature. | | 30001 | 403 | Forbidden (client IP not in the store allowlist). | | 30002 | 403 | Scope forbidden — the store lacks the `claim_link:auto_payout` scope. | | 40001 | 429 | Rate limit exceeded. | | 50103 | 400 | Create/auto-fund error (e.g. insufficient wallet balance, session/policy not ready, signing gate). See `error.details.plutus_code`, `error.details.reason`, and `error.details.reason_code` — for `plutus_code: 8148` (signing failure) `reason_code` distinguishes `session_expired` / `policy_denied` / `signer_error`. | | 50104 | 403 | Auto-payout API disabled — live signing off for this environment, or a sandbox key was used. | | 50105 | 409 | Duplicate `reference_id` mid-flight — a concurrent create for the same reference is in progress. | | 50106 | 409 | `reference_id` reused with **different parameters** (chain / coin / amount). `error.details` carries the `reference_id`, the `existing` params, and the `request` params — resend the original params, or use a new `reference_id` for a genuinely new payout. | > This table lists the errors specific to this endpoint. Unexpected server-side failures may return a generic platform error code (e.g. `90000` / `99999`) with HTTP 500 — treat **any** non-zero `code` as a failure and surface `error` + `request_id` for support. *** ## Notes * **Deliver the `claim_url` (or `token`) to your recipient over a secure channel.** The token is a bearer credential shown **once**. * The endpoint is **idempotent per `(business, store, reference_id)`** — uniqueness is scoped to the **authenticating store**, not the whole business, so a business running several stores (each with its own API key) can reuse the same `reference_id` in different stores. A retry with the same `reference_id` **on the same store and the same (chain, coin, amount)** returns the original link (with `idempotent_hit: true`) — it never double-creates or double-debits. Reusing the reference with **different** parameters is rejected with `50106` (409), not replayed. * Funding draws from **your** custodied (Turnkey) wallet; ensure it holds enough of the stable coin to cover the payout **amount plus fees**. Funding is **gasless / sponsored** — you do **not** need to hold native gas in that wallet. A balance shortfall returns `50103`. * This endpoint is currently **live on gamma (staging)** and gated off on production until the launch flag is flipped. # Optional Response Signing Source: https://developer.allscale.io/api-reference/response-signing Verify that API responses genuinely originate from AllScale. **AllScale Open API**\ **Version:** v1\ **Last updated:** 2026-01-21 *** # Overview **Applies only when `signed_response = true` for the store** *** AllScale supports optional response signing to allow clients to verify: * Response authenticity * Payload integrity * Request–response binding * Protection against replayed or substituted responses Response signing is **disabled by default**. It becomes active only when the store is created or configured with: ``` signed_response = true ``` *** ## When Response Signing Is Enabled When enabled, every API response includes additional headers that allow the client to verify the response cryptographically. *** ## Response Headers | Header | Required | Description | | - | - | - | | X-Response-Timestamp | Yes | Unix timestamp (seconds) generated by server | | X-Response-Nonce | Yes | Unique nonce generated per response | | X-Response-Signature | Yes | HMAC signature of the response | | X-Request-Nonce | Recommended | Echo of request nonce | | X-Request-Id | Yes | Unique request identifier | *** ## Response Canonical String When `signed_response = true`, the response signature is computed using: ``` STATUS_CODE PATH REQUEST_NONCE REQUEST_BODY_SHA256 RESPONSE_TIMESTAMP RESPONSE_NONCE RESPONSE_BODY_SHA256 ``` Each field is joined using newline characters (`\n`). *** ## Field Definitions | Field | Description | | - | - | | STATUS\_CODE | HTTP status code (e.g. 200) | | PATH | Request path (e.g. /v1/payments) | | REQUEST\_NONCE | X-Nonce from the request | | REQUEST\_BODY\_SHA256 | SHA256 hash of raw request body | | RESPONSE\_TIMESTAMP | Server timestamp | | RESPONSE\_NONCE | Random nonce generated per response | | RESPONSE\_BODY\_SHA256 | SHA256 hash of raw response body | > ⚠️ Important: > Hashes must be calculated using the exact raw request / response body bytes. *** ## Response Signature Algorithm **Algorithm** ``` HMAC-SHA256 ``` **Encoding** ``` Base64 ``` **Formula** ``` signature = Base64( HMAC_SHA256(api_secret, canonical_response_string) ) ``` **Header format** ``` X-Response-Signature: v1= ``` *** ## Response Example ### Response Headers ``` HTTP/1.1 200 OK X-Response-Timestamp: 1716501552 X-Response-Nonce: 8fae4c9d7e2b4b3aa1f2 X-Response-Signature: v1=dYlX5KQyZPzq2+7Gf+4... X-Request-Nonce: b4d9a2a1-9c2b-4df4-8b8e-2a13a45fd321 X-Request-Id: req_84f12a8d ``` ### Response Body ```json theme={null} { "code": 0, "payload": { "pong": "ok" }, "error": null, "request_id": "req_84f12a8d" } ``` *** ## Client Verification Steps 1. Extract headers: * X-Response-Timestamp * X-Response-Nonce * X-Response-Signature * X-Request-Nonce 2. Compute: * REQUEST\_BODY\_SHA256 * RESPONSE\_BODY\_SHA256 3. Rebuild canonical string: ``` STATUS_CODE PATH REQUEST_NONCE REQUEST_BODY_SHA256 RESPONSE_TIMESTAMP RESPONSE_NONCE RESPONSE_BODY_SHA256 ``` 4. Compute: ```ini theme={null} expected_signature = Base64(HMAC_SHA256(api_secret, canonical)) ``` 5. Compare: ```ini theme={null} expected_signature = == X-Response-Signature ``` 6. Validate: * Timestamp within ±5 minutes * Response nonce not reused *** ## Postman Response Verification Script Place this in **Postman → Tests tab** ```javascript theme={null} // ================================ // AllScale Response Signature Verify // ================================ const API_SECRET = (pm.environment.get("API_SECRET") || "").trim(); function sha256Hex(str) { return CryptoJS.SHA256(str || "").toString(CryptoJS.enc.Hex); } function hmacSha256Base64(key, msg) { const mac = CryptoJS.HmacSHA256(msg, key); return CryptoJS.enc.Base64.stringify(mac); } function getHeader(name) { return pm.response.headers.get(name) || ""; } pm.test("API_SECRET is set", function () { pm.expect(API_SECRET).to.not.eql(""); }); // ---- request-side values ---- const path = pm.request.url.getPath(); const requestNonce = pm.request.headers.get("X-Nonce") || ""; const requestBodyRaw = pm.request.body?.raw || ""; const requestBodySha = sha256Hex(requestBodyRaw); // ---- response-side values ---- const statusCode = pm.response.code; const responseTimestamp = getHeader("X-Response-Timestamp"); const responseNonce = getHeader("X-Response-Nonce"); const responseSigHeader = getHeader("X-Response-Signature"); const echoedRequestNonce = getHeader("X-Request-Nonce"); // ---- sanity checks ---- pm.test("Response signing headers present", function () { pm.expect(responseTimestamp).to.not.eql(""); pm.expect(responseNonce).to.not.eql(""); pm.expect(responseSigHeader).to.match(/^v1=.+/); }); // ---- timestamp check ---- pm.test("Response timestamp within ±5 minutes", function () { const now = Math.floor(Date.now() / 1000); const ts = parseInt(responseTimestamp, 10); pm.expect(Math.abs(now - ts)).to.be.below(300); }); // ---- response body hash ---- const responseBody = pm.response.text() || ""; const responseBodySha = sha256Hex(responseBody); // ---- canonical string ---- const canonical = [ String(statusCode), path, echoedRequestNonce || requestNonce, requestBodySha, String(responseTimestamp), responseNonce, responseBodySha, ].join("\n"); // ---- signature verification ---- const expectedSig = "v1=" + hmacSha256Base64(API_SECRET, canonical); pm.test("Response signature matches", function () { pm.expect(responseSigHeader).to.eql(expectedSig); }); // ---- optional replay protection ---- pm.test("Response nonce not replayed", function () { const key = "RESP_NONCE_CACHE"; const ttl = 600; const now = Math.floor(Date.now() / 1000); let cache = []; try { cache = JSON.parse(pm.environment.get(key) || "[]"); } catch { } cache = cache.filter(x => now - x.ts < ttl); pm.expect(cache.some(x => x.nonce === responseNonce)).to.eql(false); cache.push({nonce: responseNonce, ts: now}); pm.environment.set(key, JSON.stringify(cache)); }); ``` *** ## Replay Protection Responses are protected using: * Timestamp validation (±5 minutes) * Unique response nonce * Request–response binding via request nonce * Optional nonce replay cache on client side *** ## Error Handling Even error responses are signed. Example: ```json theme={null} { "code": 20002, "payload": null, "error": { "message": "Bad signature", "details": { "reason": "signature_mismatch" } }, "request_id": "req_xxx" } ``` Clients must still verify the response signature before trusting the error. *** ## Important Notes ### ✔ When Response Signing Is Enabled * Client must verify signature * Client must validate timestamp * Client should cache nonces * Client must reject mismatched responses ### ✔ When Response Signing Is Disabled * No `X-Response-*` headers are returned * Client should skip verification * Suitable for: * Internal testing * Low-risk integrations * Legacy compatibility *** ## Best Practices * Always verify response signature before processing data * Cache response nonces for at least 5 minutes * Reject responses with invalid timestamps * Use raw response body for hashing * Log request\_id for debugging * Never disable verification in production *** End of document. # Test Routes Source: https://developer.allscale.io/api-reference/test-routes Ping and echo endpoints for validating your credentials, clock skew, and body hashing. **AllScale Open API**\\ **Version:** v1\ **Last updated:** 2026-01-23\ **Base Path:** `/v1/test` *** ## Overview The Test API provides endpoints used to verify: * API authentication * Request signing * Replay protection * Error handling behavior * JSON body hashing and parsing All endpoints require valid authentication using the HMAC-based signing mechanism. *** ## Authentication All requests must include the following headers: | Header | Description | | - | - | | X-API-Key | API key | | X-Timestamp | Unix timestamp (seconds) | | X-Nonce | Unique request identifier | | X-Signature | HMAC signature | Requests missing any of these headers will be rejected. *** ## GET /v1/test/ping ### Description Health-check endpoint used to verify: * API connectivity * Signature correctness * Authentication configuration ### Request ``` GET /v1/test/ping ``` Headers: ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= ``` ### Successful Response ```json theme={null} { "code": 0, "payload": { "pong": "ok" }, "error": null, "request_id": "req_xxxxx" } ``` ### Response Fields | Field | Description | | - | - | | code | 0 indicates success | | payload.pong | Always returns "ok" | | error | Always null | | request\_id | Unique request identifier | ### Possible Errors | Code | Meaning | | - | - | | 20001 | Missing authentication headers | | 20002 | Invalid signature | | 30001 | Forbidden (IP not allowed) | | 40001 | Rate limit exceeded | *** ## GET /v1/test/fail ### Description This endpoint always returns a validation error.\ It is used to test client-side error handling and error parsing. ### Request ``` GET /v1/test/fail ``` Headers: ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= ``` ### Error Response ```json theme={null} { "code": 10001, "payload": null, "error": { "message": "Validation error", "details": {} }, "request_id": "req_xxxxx" } ``` ### Error Code | Code | Meaning | | - | - | | 10001 | Validation error | *** ## POST /v1/test/post ### Description Echo test endpoint. Used to verify: * Request signing * Body hashing * JSON parsing * Response format ### Request ``` POST /v1/test/post ``` Headers: ``` X-API-Key: X-Timestamp: X-Nonce: X-Signature: v1= Content-Type: application/json ``` Body (example): ```json theme={null} { "everything": "is_fine" } ``` ### Successful Response ```json theme={null} { "code": 0, "payload": { "your_request_body": { "everything": "is_fine" } }, "error": null, "request_id": "req_xxxxx" } ``` ### Notes * The request body may include any valid JSON object. * The response returns the request body under `payload.your_request_body`. ### Possible Errors | Code | Meaning | | - | - | | 20001 | Missing authentication headers | | 20002 | Invalid signature | | 30001 | Forbidden (IP not allowed) | | 40001 | Rate limit exceeded | | 10001 | Validation error (invalid JSON body) | *** ## Usage Recommendations * Use `/v1/test/ping` to verify authentication setup * Use `/v1/test/post` to verify body signing (hashing) and JSON parsing * Use `/v1/test/fail` to test error parsing * Always log `request_id` for debugging * Ensure timestamps are in UTC * Never reuse nonces *** ## Notes * All test endpoints require valid authentication * Requests are subject to replay protection * Responses follow the standard API response format *** End of document. # Checkout Payment Flow Source: https://developer.allscale.io/checkout/payment-flow End-to-end sequence from the buyer tapping checkout to the merchant receiving the webhook. The diagram below traces a full Checkout payment: the buyer taps checkout in the merchant's app, the merchant's backend creates a checkout intent, the buyer pays on the AllScale checkout page, and AllScale delivers a webhook once the transaction is confirmed on-chain. ```mermaid theme={null} flowchart TB subgraph U["User"] direction TB U1["Tap Checkout USDT"] end subgraph FE["3rd-party Frontend"] direction TB C1["Trigger AllScale Checkout"] C2["Open checkout_url"] end subgraph BE["3rd-party Backend"] direction TB TP1["Create checkout request"] TP2["POST /checkout-intents"] TP3["Receive checkout_url"] TP4["Return url to frontend"] TP5["Receive webhook"] end subgraph AS["AllScale Backend"] direction TB B1["Authenticate"] B2["Validate payload"] B3["Create checkout intent"] B4["Generate checkout_url"] B5["Return url"] B6["Receive payment completed"] B7["Wait for on-chain confirmation"] B8["Verify tx"] B9["Mark intent confirmed"] B10["Trigger webhook"] end subgraph FE2["AllScale Checkout Page"] direction TB F1["Render checkout UI"] F2["User submits payment"] F3["Notify backend"] end U1 --> C1 --> TP1 --> TP2 --> B1 --> B2 --> B3 --> B4 --> B5 --> TP3 --> TP4 --> C2 --> F1 F1 --> F2 --> F3 --> B6 --> B7 --> B8 --> B9 --> B10 --> TP5 ``` # AllScale Open API Source: https://developer.allscale.io/index Accept stablecoin payments and send payouts through the AllScale Open API. The AllScale Open API lets your platform take stablecoin payments from buyers and send funds out to recipients, without holding crypto infrastructure yourself. Every request is authenticated with an HMAC-SHA256 signature derived from your store's API key and secret — start with [Authentication & Request Signing](/api-reference/authentication). ## Base URLs | Environment | Base URL | | - | - | | Production | `https://openapi.allscale.io` | ## Start here > **[Authentication](/api-reference/authentication)** > > Sign your first request: headers, canonical string, and signature. > **[Test Routes](/api-reference/test-routes)** > > Verify your credentials, clock, and body hashing before writing integration code. > **[Create a Checkout Intent](/api-reference/checkout-intents/create)** > > Create an intent and redirect your buyer to the hosted checkout page. > **[Postman Collection](/postman/quickstart)** > > Import a ready-to-run collection with the request signer already wired up. ## What you can build > **[Checkout](/api-reference/checkout-intents/create)** > > Create a checkout intent and redirect your buyer to the hosted checkout page. > **[Claim Links](/api-reference/claim-links/create-auto-payout)** > > Send an auto-payout to a recipient, and claim it back while it is still unclaimed. > **[Webhooks](/webhooks/checkout-webhook)** > > Signed, retried callbacks for payment and claim-link events. > **[Payment Flow](/checkout/payment-flow)** > > The end-to-end sequence across buyer, your backend, and AllScale. > [!NOTE] > > Your `api_key` and `api_secret` are shown **once** in the merchant dashboard. > Contact the AllScale BD team to have a store provisioned. # AllScale_OpenAPI.postman_collection.json Source: https://developer.allscale.io/postman/collection ```json theme={null} { "info": { "_postman_id": "a11sc4le-0pen-4p1-0000-000000000001", "name": "AllScale OpenAPI (v1)", "description": "Ready-to-use Postman collection for AllScale's third-party OpenAPI.\n\n_Aligned with docs/openapi (Create v4 / Get v5 / Get-Status v2 — 2026-05-06)._\n\n**Setup**\n\n1. Import this collection **and** the companion environment file (`AllScale_OpenAPI.postman_environment.json`).\n2. Pick the environment (top-right dropdown).\n3. Fill in `api_key` and `api_secret` (shown once in the merchant dashboard — store them in the environment, not the collection).\n4. `base_url` defaults to the **sandbox** host; switch to the production host when ready.\n\n**How signing works**\n\nThe collection has a pre-request script at the root that runs before every request. It:\n\n- Reads `api_key` / `api_secret` from the active environment\n- Builds the canonical string `METHOD\\nPATH\\nQUERY\\nTIMESTAMP\\nNONCE\\nBODY_SHA256`\n- Signs it with HMAC-SHA256 + Base64\n- Upserts `X-API-Key`, `X-Timestamp`, `X-Nonce`, `X-Signature: v1=` headers\n\nYou should not need to touch the script for normal QA usage — just run a request.\n\n**Ordered happy-path**\n\n1. `Test / GET /v1/test/ping` — confirms connectivity + signing.\n2. `Test / POST /v1/test/post` — confirms body hashing.\n3. `Checkout Intent / Create — fiat` (or `Create — native stable-coin`) — creates an intent and auto-captures `checkout_intent_id` into the environment.\n4. `Checkout Intent / GET /v1/checkout_intents/{id}/status` — polls status.\n5. `Checkout Intent / GET /v1/checkout_intents/{id}` — full payload.\n\n**Pricing modes on Create** (pick exactly one per request):\n\n- `currency` (fiat IntEnum, Appendix A) → server FX-converts to the resolved settlement coin (USDT or USDC); use `accepted_stable_coins` to pick which.\n- `stable_coin` (IntEnum, Appendix B) → `1` (USDT) and `2` (USDC) are accepted; amount is stable-coin cents, no FX.\n\nSending both, or neither, returns `10001`.\n\n**Settlement:** USDT or USDC. `stable_coin_type` in the response matches the resolved coin (defaults to `1` USDT when neither `stable_coin` nor `accepted_stable_coins` is set).\n\n**Error codes** (from the server's unified envelope):\n\n| Code | Meaning |\n|-------|---------|\n| 0 | Success |\n| 10001 | Validation error |\n| 20001 | Missing auth headers |\n| 20002 | Bad signature |\n| 30001 | Forbidden (IP / ownership) |\n| 40001 | Rate limit exceeded |\n| 50001 | Checkout intent not found |\n| 50002 | Create checkout intent error (e.g. amount at or below the 0.1-coin floor) |\n| 90000 | Internal server error |\n", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "auth": { "type": "noauth" }, "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "exec": [ "// AllScale HMAC-SHA256 request signing.", "// See docs/openapi/docs/API Doc - Auth.md for the canonical-string format.", "", "const apiKey = pm.environment.get('api_key') || pm.collectionVariables.get('api_key') || '';", "const apiSecret = (pm.environment.get('api_secret') || pm.collectionVariables.get('api_secret') || '').trim();", "", "if (!apiKey || !apiSecret) {", " console.warn('[AllScale] api_key or api_secret is empty — requests will be rejected (20001/20002).');", "}", "", "// Method", "const method = (pm.request.method || 'GET').toUpperCase();", "", "// Path — resolve {{var}} placeholders and :path params via pm.variables.replaceIn.", "const urlObj = pm.request.url;", "const rawPathSegments = (urlObj.path || []).map(function (seg) {", " return pm.variables.replaceIn(String(seg));", "});", "let path = '/' + rawPathSegments.join('/');", "// Postman treats a trailing slash in the URL as an empty segment; keep it so the canonical path", "// matches what Starlette sees on the server (e.g. /v1/checkout_intents/).", "", "// Query — use Postman's resolved query string so encoding matches what actually goes on the wire.", "let query = '';", "try {", " query = urlObj.getQueryString({ ignoreDisabled: true }) || '';", "} catch (e) {", " // Older Postman runtimes — fall back to manual build.", " const parts = [];", " (urlObj.query || []).each(function (q) {", " if (q.disabled) return;", " const k = pm.variables.replaceIn(q.key || '');", " const v = pm.variables.replaceIn(q.value || '');", " parts.push(k + '=' + v);", " });", " query = parts.join('&');", "}", "", "// Body — only raw JSON bodies are signed with content. Other modes sign an empty body.", "let body = '';", "if (pm.request.body && pm.request.body.mode === 'raw' && pm.request.body.raw) {", " body = pm.variables.replaceIn(pm.request.body.raw);", "}", "", "// Canonical pieces", "const bodyHash = CryptoJS.SHA256(body).toString(CryptoJS.enc.Hex);", "const timestamp = Math.floor(Date.now() / 1000).toString();", "", "function uuidv4() {", " if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {", " return crypto.randomUUID();", " }", " // RFC 4122 v4 fallback", " return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {", " const r = Math.random() * 16 | 0;", " const v = c === 'x' ? r : (r & 0x3 | 0x8);", " return v.toString(16);", " });", "}", "const nonce = uuidv4();", "", "const canonical = [method, path, query, timestamp, nonce, bodyHash].join('\\n');", "const signature = CryptoJS.HmacSHA256(canonical, apiSecret).toString(CryptoJS.enc.Base64);", "", "pm.request.headers.upsert({ key: 'X-API-Key', value: apiKey });", "pm.request.headers.upsert({ key: 'X-Timestamp', value: timestamp });", "pm.request.headers.upsert({ key: 'X-Nonce', value: nonce });", "pm.request.headers.upsert({ key: 'X-Signature', value: 'v1=' + signature });", "", "// Uncomment for debugging:", "// console.log('[AllScale canonical]\\n' + canonical);", "// console.log('[AllScale signature] v1=' + signature);", "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "exec": [ "// Collection-wide sanity checks.", "pm.test('Response is JSON', function () {", " pm.response.to.be.withBody;", " pm.response.to.be.json;", "});", "", "pm.test('Envelope has `code` and `request_id`', function () {", " const body = pm.response.json();", " pm.expect(body).to.have.property('code');", " pm.expect(body).to.have.property('request_id');", "});", "" ] } } ], "variable": [ { "key": "base_url", "value": "{{base_url}}", "type": "string" } ], "item": [ { "name": "Test", "description": "Smoke-test endpoints. Run these first to validate credentials, signing, and body hashing before touching real payment flows.", "item": [ { "name": "GET /v1/test/ping", "request": { "method": "GET", "header": [], "url": { "raw": "{{base_url}}/v1/test/ping", "host": [ "{{base_url}}" ], "path": [ "v1", "test", "ping" ] }, "description": "Health-check. Verifies that:\n\n- `api_key` / `api_secret` are valid\n- Your clock is in sync (±5 min window)\n- The signing pre-request script is producing a correct signature\n\nExpected: `{ \"code\": 0, \"payload\": { \"pong\": \"ok\" }, ... }`" }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "pm.test('code == 0', function () {", " pm.expect(pm.response.json().code).to.eql(0);", "});", "pm.test('payload.pong == \"ok\"', function () {", " pm.expect(pm.response.json().payload.pong).to.eql('ok');", "});" ] } } ] }, { "name": "GET /v1/test/fail", "request": { "method": "GET", "header": [], "url": { "raw": "{{base_url}}/v1/test/fail", "host": [ "{{base_url}}" ], "path": [ "v1", "test", "fail" ] }, "description": "Always returns `10001 Validation error`. Use it to verify your error-handling branch parses the envelope correctly." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "pm.test('code == 10001 (validation error)', function () {", " pm.expect(pm.response.json().code).to.eql(10001);", "});" ] } } ] }, { "name": "POST /v1/test/post", "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"everything\": \"is_fine\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{base_url}}/v1/test/post", "host": [ "{{base_url}}" ], "path": [ "v1", "test", "post" ] }, "description": "Echo endpoint. Verifies body-hash signing — if this passes but real endpoints return `20002`, the client almost certainly isn't hashing the body the same way the server does.\n\nThe server echoes the body back under `payload.your_request_body`." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "pm.test('code == 0', function () {", " pm.expect(pm.response.json().code).to.eql(0);", "});", "pm.test('body was echoed', function () {", " pm.expect(pm.response.json().payload.your_request_body.everything).to.eql('is_fine');", "});" ] } } ] } ] }, { "name": "Checkout Intent", "description": "End-to-end checkout-intent lifecycle. Create → poll status → fetch full detail. `Create` captures the returned intent id into the `checkout_intent_id` environment variable so the two GETs work without manual copy-paste.\n\n**Two create flavors** (pick exactly one on each request):\n\n- **Fiat pricing** — send `currency` (IntEnum, Appendix A). The server FX-converts to the resolved settlement coin (USDT or USDC) at the current rate; `currency_rate` in the response is non-null. Use `accepted_stable_coins` (first entry wins) to pick the settlement coin; defaults to USDT.\n- **Native stable-coin pricing** — send `stable_coin` (IntEnum, Appendix B). `amount_cents` is stable-coin cents (`1000` = `10.00` of the chosen coin). No FX happens, so `currency_rate` in the response is `null`. Both `stable_coin = 1` (USDT) and `stable_coin = 2` (USDC) are accepted.\n\nSending both — or neither — of `currency`/`stable_coin` returns `10001`.", "item": [ { "name": "POST /v1/checkout_intents/ (Create — fiat)", "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"currency\": 1,\n \"amount_cents\": 100,\n \"order_id\": \"qa_order_{{$timestamp}}\",\n \"order_description\": \"QA test order\",\n \"user_id\": \"qa_user_001\",\n \"user_name\": \"QA Tester\",\n \"redirect_url\": \"https://example.com/checkout/allscale\",\n \"extra\": {\n \"source\": \"postman\"\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{base_url}}/v1/checkout_intents/", "host": [ "{{base_url}}" ], "path": [ "v1", "checkout_intents", "" ] }, "description": "Create a checkout intent priced in fiat. Server FX-converts the amount into the resolved settlement coin (USDT or USDC) at the current rate.\n\n**Field notes**\n\n- `currency` is the fiat IntEnum (1 = USD, 44 = EUR, …). Full table in `API Doc - Checkout Intent Routes - Create Checkout Intent.md` → Appendix A.\n- `amount_cents` is integer **fiat** cents. The resulting stable-coin amount must be greater than `0.1` (USDT or USDC); orders at or below the floor are rejected with `50002`.\n- Do **not** also send `stable_coin` on this request — sending both returns `10001`.\n- `redirect_url` must be `https://…` in production; sandbox also allows `http://`.\n- Settlement coin is **USDT or USDC**. To pin it on a fiat-priced order, send `accepted_stable_coins: [1]` (USDT) or `[2]` (USDC); the first entry picks the settlement coin used for FX conversion. `stable_coin_type` in the response matches whichever was resolved (defaults to `1` USDT).\n\nThe post-response test captures `payload.allscale_checkout_intent_id` into `{{checkout_intent_id}}` for the follow-up GETs." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "const body = pm.response.json();", "pm.test('code == 0', function () {", " pm.expect(body.code).to.eql(0);", "});", "pm.test('payload.allscale_checkout_intent_id exists', function () {", " pm.expect(body.payload).to.have.property('allscale_checkout_intent_id');", " pm.expect(body.payload.allscale_checkout_intent_id).to.be.a('string');", "});", "", "if (body && body.payload && body.payload.allscale_checkout_intent_id) {", " pm.environment.set('checkout_intent_id', body.payload.allscale_checkout_intent_id);", " console.log('[AllScale] captured checkout_intent_id = ' + body.payload.allscale_checkout_intent_id);", "}" ] } } ] }, { "name": "POST /v1/checkout_intents/ (Create — native stable-coin)", "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"stable_coin\": 1,\n \"amount_cents\": 1000,\n \"order_id\": \"qa_stable_{{$timestamp}}\",\n \"order_description\": \"QA native USDT order\",\n \"user_id\": \"qa_user_001\",\n \"user_name\": \"QA Tester\",\n \"redirect_url\": \"https://example.com/checkout/allscale\",\n \"extra\": {\n \"source\": \"postman\",\n \"pricing\": \"native_stable_coin\"\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{base_url}}/v1/checkout_intents/", "host": [ "{{base_url}}" ], "path": [ "v1", "checkout_intents", "" ] }, "description": "Create a checkout intent priced **natively in a stable coin** — no FX happens.\n\n**Field notes**\n\n- `stable_coin` is the StableCoin IntEnum (see Appendix B). Both `1` (USDT) and `2` (USDC) are accepted; other values are reserved and will be rejected.\n- `amount_cents` is **stable-coin cents** of the chosen `stable_coin`: `1000` = `10.00` of that coin. The example above (`stable_coin: 1`) produces a `10 USDT` order; switch to `stable_coin: 2` for the equivalent USDC order.\n- Do **not** also send `currency` — sending both, or neither, returns `10001`.\n- The response's `currency_rate` will be `null` (no FX). In the full GET, the fiat fields (`currency`, `currency_symbol`, `amount_cents`, `currency_rate`) will all be `null`; the authoritative amount is `amount_coins`.\n\nThe post-response test captures `payload.allscale_checkout_intent_id` into `{{checkout_intent_id}}` just like the fiat flavor." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "const body = pm.response.json();", "pm.test('code == 0', function () {", " pm.expect(body.code).to.eql(0);", "});", "pm.test('payload.allscale_checkout_intent_id exists', function () {", " pm.expect(body.payload).to.have.property('allscale_checkout_intent_id');", "});", "pm.test('rate is null for native stable-coin pricing', function () {", " pm.expect(body.payload.rate).to.be.oneOf([null, undefined]);", "});", "", "if (body && body.payload && body.payload.allscale_checkout_intent_id) {", " pm.environment.set('checkout_intent_id', body.payload.allscale_checkout_intent_id);", " console.log('[AllScale] captured checkout_intent_id = ' + body.payload.allscale_checkout_intent_id);", "}" ] } } ] }, { "name": "GET /v1/checkout_intents/{id}/status", "request": { "method": "GET", "header": [], "url": { "raw": "{{base_url}}/v1/checkout_intents/{{checkout_intent_id}}/status", "host": [ "{{base_url}}" ], "path": [ "v1", "checkout_intents", "{{checkout_intent_id}}", "status" ] }, "description": "Poll-friendly lightweight status check. `payload` is the status integer (see status enum in the doc).\n\nUse this instead of the full GET when all you need is the lifecycle state." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "const body = pm.response.json();", "pm.test('code == 0', function () {", " pm.expect(body.code).to.eql(0);", "});", "pm.test('payload is integer status', function () {", " pm.expect(body.payload).to.be.a('number');", "});" ] } } ] }, { "name": "GET /v1/checkout_intents/{id}", "request": { "method": "GET", "header": [], "url": { "raw": "{{base_url}}/v1/checkout_intents/{{checkout_intent_id}}", "host": [ "{{base_url}}" ], "path": [ "v1", "checkout_intents", "{{checkout_intent_id}}" ] }, "description": "Full checkout intent object — order metadata, currency/coin fields, on-chain tx hashes when payment has settled. Ownership is enforced: the intent must belong to the store identified by `api_key`, otherwise `30001 Forbidden`." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "const body = pm.response.json();", "pm.test('code == 0', function () {", " pm.expect(body.code).to.eql(0);", "});", "pm.test('payload has core fields', function () {", " const p = body.payload;", " pm.expect(p).to.have.property('all_scale_checkout_intent_id');", " pm.expect(p).to.have.property('currency');", " pm.expect(p).to.have.property('amount_cents');", " pm.expect(p).to.have.property('status');", " pm.expect(p).to.have.property('tx_to');", "});" ] } } ] } ] }, { "name": "Claim Link", "item": [ { "name": "POST /v1/claim_link_auto_payouts (Create + Auto-Payout)", "request": { "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"amount\": \"10.50\",\n \"stable_coin\": 1,\n \"chain\": 5,\n \"receiver_email\": \"recipient@example.com\",\n \"sender_display_name\": \"Acme Payouts\",\n \"sender_message\": \"Your July payout\",\n \"reference_id\": \"payout_2026_07_0001\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{base_url}}/v1/claim_link_auto_payouts", "host": [ "{{base_url}}" ], "path": [ "v1", "claim_link_auto_payouts" ] }, "description": "Create a single claim link and auto-fund it from the merchant's custodied wallet. Requires the claim_link:auto_payout scope, a non-sandbox key, and CLAIM_LINK_LIVE_SIGNING_ENABLED. See 'API Doc - Claim Link Routes - Create Auto-Payout.md'." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "const body = pm.response.json();", "pm.test('code == 0', function () {", " pm.expect(body.code).to.eql(0);", "});", "pm.test('payload.claim_link_id exists', function () {", " pm.expect(body.payload).to.have.property('claim_link_id');", " pm.expect(body.payload.claim_link_id).to.be.a('string');", "});", "pm.test('payload.status is a string', function () {", " pm.expect(body.payload).to.have.property('status');", " pm.expect(body.payload.status).to.be.a('string');", "});", "pm.test('payload.idempotent_hit is a boolean', function () {", " pm.expect(body.payload).to.have.property('idempotent_hit');", " pm.expect(body.payload.idempotent_hit).to.be.a('boolean');", "});", "", "if (body && body.payload) {", " if (body.payload.claim_link_id) {", " pm.environment.set('claim_link_id', body.payload.claim_link_id);", " console.log('[AllScale] captured claim_link_id = ' + body.payload.claim_link_id);", " }", " // The bearer token is returned ONCE on a fresh create (null on an idempotent replay).", " if (body.payload.token) {", " pm.environment.set('claim_link_token', body.payload.token);", " console.log('[AllScale] captured claim_link_token (bearer, treat as secret)');", " }", "}" ] } } ], "response": [] }, { "name": "POST /v1/claim_link_auto_payouts/{id}/cancel (Cancel / Claim-Back)", "request": { "method": "POST", "header": [], "url": { "raw": "{{base_url}}/v1/claim_link_auto_payouts/{{claim_link_id}}/cancel", "host": [ "{{base_url}}" ], "path": [ "v1", "claim_link_auto_payouts", "{{claim_link_id}}", "cancel" ] }, "description": "Cancel (claim back) one of your own FUNDED, UNCLAIMED claim links. No request body. Flips the link to 'cancelled' and schedules the refund off the request path; the 'cancelled' webhook fires once the refund settles on-chain. Requires the claim_link:auto_payout scope and a non-sandbox key; NOT gated by CLAIM_LINK_LIVE_SIGNING_ENABLED. 50107 = unknown/non-owned/malformed id, 50108 = not cancellable (pending_deposit / claiming / terminal / batch). Uses {{claim_link_id}} captured by the Create request. See 'API Doc - Claim Link Routes - Cancel Auto-Payout.md'." }, "event": [ { "listen": "test", "script": { "type": "text/javascript", "exec": [ "const body = pm.response.json();", "pm.test('code == 0', function () {", " pm.expect(body.code).to.eql(0);", "});", "pm.test(\"payload.status == 'cancelled'\", function () {", " pm.expect(body.payload).to.have.property('status');", " pm.expect(body.payload.status).to.eql('cancelled');", "});", "pm.test(\"payload.refund_status == 'refund_pending'\", function () {", " pm.expect(body.payload).to.have.property('refund_status');", " pm.expect(body.payload.refund_status).to.eql('refund_pending');", "});", "// The refund settles OFF the request path — wait for the 'cancelled' webhook", "// (refund_tx_hash) rather than treating this 200 as 'money is back'." ] } } ], "response": [] } ], "description": "Merchant claim-link create endpoint (auto-payout). Flag-gated + scoped; see the Claim Link Auto-Payout API doc. (Batch endpoint docs land with the batch launch.)" } ] } ``` # AllScale_OpenAPI_Production.postman_environment.json Source: https://developer.allscale.io/postman/env ```json theme={null} { "id": "a11sc4le-0pen-4p1-env2-000000000002", "name": "AllScale OpenAPI — Production", "values": [ { "key": "base_url", "value": "https://openapi.allscale.io", "type": "default", "enabled": true }, { "key": "api_key", "value": "", "type": "default", "enabled": true }, { "key": "api_secret", "value": "", "type": "secret", "enabled": true }, { "key": "checkout_intent_id", "value": "", "type": "default", "enabled": true } ], "_postman_variable_scope": "environment", "_postman_exported_using": "AllScale docs" } ``` # Postman Collection Source: https://developer.allscale.io/postman/quickstart Import the ready-to-run Postman collection with a built-in HMAC request signer. Out-of-the-box Postman assets for partner engineers. Import, fill in credentials, and you can hit every documented v1 endpoint with valid HMAC-signed requests. ## Files | File | What it is | | - | - | | `AllScale_OpenAPI.postman_collection.json` | Collection — all v1 endpoints + collection-level request signer + response assertions. | | `AllScale_OpenAPI_Production.postman_environment.json` | Production environment (`https://openapi.allscale.io`). | ## Download > **[Collection](/postman/AllScale_OpenAPI.postman_collection.json)** > > All v1 endpoints + request signer > **[Sandbox environment](/postman/AllScale_OpenAPI.postman_environment.json)** > > openapi-sandbox.allscale.io > **[Production environment](/postman/AllScale_OpenAPI_Production.postman_environment.json)** > > openapi.allscale.io ## Import (Postman desktop or web) 1. **File → Import** → drop all three JSON files in at once. 2. Top-right environment dropdown → pick **AllScale OpenAPI — Sandbox**. 3. Open the environment, paste your `api_key` and `api_secret`, save. * `api_secret` is stored with Postman's `secret` type and is masked. * Both values are shown **once** in the merchant dashboard — keep them safe. `base_url` and `checkout_intent_id` are already wired up; you should not need to edit them. ## Suggested run order 1. **Test / GET `/v1/test/ping`** — confirms keys + clock + signing. 2. **Test / POST `/v1/test/post`** — confirms body hashing. 3. **Checkout Intent / Create — fiat** *or* **Create — native stable-coin** — creates an intent and auto-saves `checkout_intent_id` into the environment. * Fiat: send `currency` (IntEnum). Server FX-converts to the resolved settlement coin (USDT or USDC); use `accepted_stable_coins` to pick which (first entry wins; defaults to USDT when omitted). * Native stable-coin: send `stable_coin` — `1` (USDT) or `2` (USDC) are both accepted. `amount_cents` is stable-coin cents, no FX, and `currency_rate` will be `null`. * Send exactly one — both or neither returns `10001`. 4. **Checkout Intent / GET `/v1/checkout_intents/{id}/status`** — polls the lifecycle state. 5. **Checkout Intent / GET `/v1/checkout_intents/{id}`** — full detail. * For a native-stable-coin intent, the fiat fields (`currency`, `currency_symbol`, `amount_cents`, `currency_rate`) will be `null`; the authoritative amount lives in `amount_coins`. You can also run the whole collection with Postman's **Collection Runner** — every request has assertions attached, so the runner report is a usable QA smoke-test. ## How signing works (for the curious) A pre-request script lives at the **collection root**, so it runs before every request without per-request setup. For each call it: 1. Reads `api_key` / `api_secret` from the active environment. 2. Builds the canonical string `METHOD\nPATH\nQUERY\nTIMESTAMP\nNONCE\nBODY_SHA256` (body hash = `sha256_hex(raw_body_bytes)`; empty body hashes the empty string). 3. Signs it with HMAC-SHA256, base64-encoded. 4. Upserts the required headers: `X-API-Key`, `X-Timestamp`, `X-Nonce`, `X-Signature: v1=`. No need to touch the script for normal QA — but if a signature ever looks wrong, uncomment the two `console.log` lines at the bottom of the pre-request script to dump the canonical string and produced signature to the Postman console. ## Troubleshooting | Symptom | Likely cause | | - | - | | `20001 missing_headers` | `api_key` / `api_secret` not set in the active environment. | | `20002 timestamp_out_of_window` | Your machine's clock is off; sync NTP (±5 min window). | | `20002 signature_mismatch` on POSTs only | Body was edited after the script ran, or Content-Type isn't `application/json`. Re-send; the script re-hashes on every send. | | `20002 replay_nonce` | Sending two requests with the same nonce within the replay window. The script generates a new UUID every send, so this should not happen — double-check you don't have the script disabled. | | `30001 ip_not_allowed` | Your egress IP isn't on the merchant IP allowlist. | | `40001` | Rate limited. Back off per the `retry_after` in the error details. | | `50001` | `checkout_intent_id` is unset or belongs to another merchant. Re-run **Create** to capture a fresh id. | | `50002` | `Create` rejected the request (e.g. `amount must be greater than 0.1 ` when the order is at or below the 0.1-coin floor). Read `error.details.reason` for the specifics. | ## Updating the package When endpoints change, edit `AllScale_OpenAPI.postman_collection.json` in this repo, then re-export the matching `.json` from Postman — or just keep editing JSON directly. Try to keep the canonical-string script in sync with `thirdparty_api/auth/__init__.py::_canonical_request`; they must produce byte-identical canonical strings. # Checkout Webhook Source: https://developer.allscale.io/webhooks/checkout-webhook Webhook payload schema, signature verification, retry behaviour, and idempotency. **AllScale Open API**\ **Version:** v7\ **Last Updated:** 2026-10-22 *** ## Overview AllScale delivers event notifications to your server via **Webhook callbacks**. Each webhook request is authenticated using **HMAC-SHA256 request signing**, providing: * Sender authentication (shared secret) * Payload integrity (tamper-proof) * Replay attack protection (timestamp + nonce) * Stateless verification (no session required) Webhook payloads are plaintext JSON (not encrypted). *** ## Credentials When your integration/store is created, you receive: | Field | Description | | - | - | | api\_key | Public identifier | | api\_secret | Secret key used for signature verification | ### Important Notes * `api_secret` is shown only once * It cannot be retrieved again * Store it securely * Treat it like a password or private key *** ## Webhook Request ### Method ```http theme={null} POST ``` ### Content-Type ```http theme={null} application/json ``` ### Required Headers | Header | Description | | - | - | | X-API-Key | API key | | X-Webhook-Id | Unique webhook ID | | X-Webhook-Timestamp | Unix timestamp(seconds) | | X-Webhook-Nonce | Unique per-request nonce | | X-Webhook-Signature | HMAC signature | *** ## Signature Header Format ```http theme={null} X-Webhook-Signature: v1= ``` *** ## Replay Protection To prevent replay attacks: ### Requirements * Timestamp must be within **±5 minutes** * Each nonce must be used **only once** ### Recommended Implementation * Store `nonce` in Redis * TTL: **600 seconds** * Reject duplicate nonces *** ## Canonical String (v1) Webhook signatures are generated using a canonical string. ### Canonical Format ```text theme={null} allscale:webhook:v1 METHOD PATH QUERY_STRING WEBHOOK_ID TIMESTAMP NONCE BODY_SHA256 ``` *** ## Field Description | Field | Description | | - | - | | METHOD | HTTP method (uppercase) | | PATH | URL path only | | QUERY\_STRING | Query string without `?` | | WEBHOOK\_ID | From `X-Webhook-Id` | | TIMESTAMP | From `X-Webhook-Timestamp` | | NONCE | From `X-Webhook-Nonce` | | BODY\_SHA256 | SHA256 hex of raw body bytes | ⚠️ **Important** `BODY_SHA256` must be calculated from the **raw request body bytes**,\ **before JSON parsing or re-serialization**. *** ## Signature Algorithm ### Algorithm ```text theme={null} HMAC-SHA256 ``` ### Encoding ```text theme={null} Base64 ``` ### Formula ```text theme={null} signature = Base64( HMAC_SHA256(api_secret, canonical_string_bytes) ) ``` *** ## Header Example ``` X-Webhook-Signature: v1= ``` *** # Webhook Payload The request body sent by AllScale is **exactly** the following JSON structure. ## JSON Field Definitions | Field | Type | Required | Description | | - | - | - | - | | all\_scale\_transaction\_id | string | ✅ | AllScale transaction ID for this payment/transfer | | all\_scale\_checkout\_intent\_id | string | ✅ | AllScale checkout intent ID associated with the payment | | webhook\_id | string | ✅ | Unique webhook ID (must match `X-Webhook-Id`) | | amount\_cents | integer | ✅ | Always the integer the merchant submitted on `POST /v1/checkout_intents/`. For fiat-priced intents this is fiat cents; for stable-coin-priced intents it is stable-coin "cents" (1.00 coin = 100 cents, equivalent to `int(amount_coins * 100)`). | | currency | integer \| null | ➖ | Currency enum value (int). Must be interpreted using AllScale Currency enum mapping. `null` when the intent was priced natively in a stable coin — read `coin_symbol` instead. | | currency\_symbol | string \| null | ➖ | Fiat currency symbol (e.g., `USD`, `CAD`, `CNY`). `null` when the intent was priced natively in a stable coin — read `coin_symbol` instead. | | amount\_coins | string | ✅ | Stablecoin amount as a **decimal string** (to avoid float issues), e.g. `"12.340000"` | | coin\_contract\_address | string | ✅ | Official ERC-20 token contract address | | coin\_symbol | string | ✅ | Stablecoin symbol (e.g., `USDT`, `USDC`) | | chain\_id | integer | ✅ | EIP-155 chainId identifying the EVM network ([https://chainid.network/](https://chainid.network/)) | | tx\_hash | string | ✅ | On-chain transaction hash | | tx\_from | string | ✅ | Sender wallet address | | payment\_method\_type | integer | ✅ | Payment method type used for this transaction. Value must correspond to the `PaymentMethodType` enum: `0=UNKNOWN`, `1=WALLET_SCAN`, `2=WALLET_CONNECT`, `3=ALL_SCALE_PAY`. | | user\_id | string \| null | ➖ | Optional merchant/user identifier | | order\_id | string \| null | ➖ | Optional merchant order identifier | | user\_name | string \| null | ➖ | Optional customer/user display name | | extra\_obj | object \| null | ➖ | Optional arbitrary JSON object with extra fields | | status | integer \| null | ➖ | Settlement state of the checkout at the moment the callback was built. `20` = confirmed (paid). **Check `status == 20` before treating an order as paid** — do not infer payment from the mere arrival of a callback. `null` only on callbacks emitted before this field existed. See [Verifying a callback](#verifying-a-callback). | | actual\_paid\_amount | string \| null | ➖ | Amount the **buyer paid**, as a decimal string in the same unit as `amount_coins`. This is not necessarily the amount credited to your wallet — see [Verifying a callback](#verifying-a-callback). `null` when it was not recorded. | | net\_income\_amount | string \| null | ➖ | Amount **credited to your wallet** for this order, as a decimal string in the same unit as `amount_coins` — the figure to reconcile your settlement against. Can differ from `actual_paid_amount` on an overpayment or on a short payment settled within tolerance — see [Verifying a callback](#verifying-a-callback). For temporary-wallet payments it is the same value as `net_income_amount` on `GET /v1/checkout_intents/{id}`. `null` when it was not recorded, including on a re-delivery of a callback originally sent before this field existed. | ## Verifying a callback Three fields let you confirm a payment from the callback itself rather than assuming that receiving one means "paid". **`status` — check it before marking an order paid.** A callback is only ever *built* on confirmed settlement, so in practice `status` is `20`. Check it anyway: it is the field that makes the assumption explicit, and an integration that defaults a missing or unexpected status to "paid" will mark unpaid orders as paid. Treat anything other than `20` as *not paid*, and treat `null` the same way unless you are knowingly processing a historical callback from before this field shipped. **`actual_paid_amount` — it is the buyer's payment, not always your credit.** Read it as "what the buyer sent", and note that the two are not always equal: * When the buyer pays your wallet directly, no platform fee is deducted along the way, so this equals the amount credited to you. * When the payment is routed through an AllScale temporary wallet, this is the buyer's **gross** deposit. AllScale deducts the platform fee before settling to you, so the amount credited to your wallet is **lower** than this value. So use `actual_paid_amount` to check what the buyer paid against what you charged. Do **not** use it as the figure to reconcile your wallet balance against — use `net_income_amount` for that. **`net_income_amount` — what was actually credited to you.** This is the amount settled to your wallet for this order, and it can differ from `actual_paid_amount` in either direction: * **Platform fee.** When the payment is routed through an AllScale temporary wallet, the platform fee is deducted before settling, so this is lower than the buyer's payment. * **Overpayment.** If a payment routed through an AllScale temporary wallet sends more than `amount_coins`, the excess is **not** forwarded to you: your settlement is based on `amount_coins`, while `actual_paid_amount` shows the larger amount the buyer sent. * **Short payment within tolerance.** If a payment routed through an AllScale temporary wallet is slightly less than `amount_coins` but within the platform's payment-amount tolerance, AllScale absorbs the shortfall and settles you as if the full amount had been paid, so this can be **higher** than what `actual_paid_amount` alone would imply. * When the buyer pays your wallet directly (no platform fee leg), it equals `actual_paid_amount`. `amount_cents` and `amount_coins` remain the amount you *requested*, unchanged by what was actually paid; comparing `actual_paid_amount` against them is how you detect an underpayment or overpayment. ## Actual Webhook Body Example (Matches Real Structure) ### Fiat-priced intent (merchant created with `currency`) ```json theme={null} { "all_scale_transaction_id": "txn_123", "all_scale_checkout_intent_id": "chk_456", "webhook_id": "whk_84f12a8d", "amount_cents": 1234, "currency": 1, "currency_symbol": "USD", "amount_coins": "12.340000", "coin_contract_address": "0xdAC17F958D2ee523a2206206994597C13D831ec7", "coin_symbol": "USDT", "chain_id": 1, "tx_hash": "0x...", "tx_from": "0x...", "payment_method_type": 1, "user_id": "user_001", "order_id": "order_8899", "user_name": "Alice", "extra_obj": { "source": "mobile", "note": "promo-applied" }, "status": 20, "actual_paid_amount": "12.340000", "net_income_amount": "12.216600" } ``` ### Stable-coin-priced intent (merchant created with `stable_coin`) `amount_cents` is still an integer and equals `amount_coins * 100`. `currency` and `currency_symbol` are `null` — the buyer paid the merchant directly in `coin_symbol`, no fiat currency is involved. ```json theme={null} { "all_scale_transaction_id": "txn_123", "all_scale_checkout_intent_id": "chk_456", "webhook_id": "whk_84f12a8d", "amount_cents": 1000, "currency": null, "currency_symbol": null, "amount_coins": "10.000000", "coin_contract_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "coin_symbol": "USDC", "chain_id": 1, "tx_hash": "0x...", "tx_from": "0x...", "payment_method_type": 1, "user_id": "user_001", "order_id": "order_8899", "user_name": "Alice", "extra_obj": null, "status": 20, "actual_paid_amount": "10.000000", "net_income_amount": "10.000000" } ``` *** ## Verification Flow (Your Server Side) 1. Extract headers 2. Validate timestamp (±300 seconds) 3. Validate nonce (store with TTL) 4. Read raw request body bytes (before parsing JSON) 5. Compute SHA256 of raw body 6. Rebuild canonical string 7. Compute expected signature 8. Timing-safe compare 9. Only after verification → process payload *** ## Response Expectations Your endpoint should respond: * `200 OK` if processed successfully * Non-200 if rejected (signature invalid, timestamp invalid, etc.) AllScale will log the HTTP status and may retry depending on configured policy. *** ## Best Practices ✅ Always verify `X-Webhook-Signature` before processing\ ✅ Validate timestamp within ±5 minutes\ ✅ Cache nonce for replay protection\ ✅ Use idempotency via `webhook_id`\ ✅ Convert `amount_coins` using Decimal (not float)\ ❌ Never log secrets or signatures *** ## Troubleshooting | Issue | Cause | Fix | | - | - | - | | Signature mismatch | Body modified | Use raw bytes exactly as received | | Signature mismatch | Wrong path/query | Use the exact request path and query string | | Signature mismatch | Wrong secret | Verify correct `api_secret` | | Timestamp rejected | Clock drift | Sync server time (NTP) | | Replay rejected | Nonce reused | Generate unique nonce; store with TTL | *** End of Document # Claim Link Webhook Source: https://developer.allscale.io/webhooks/claim-link-webhook Events emitted over the lifetime of a claim link, and how to verify them. **AllScale Open API**\ **Version:** v4\ **Last Updated:** 2026-07-15 *** ## Overview When a **Claim Link** reaches a terminal state **and the corresponding on-chain settlement succeeds**, AllScale POSTs a notification to your configured webhook endpoint. This lets your backend react to a claim, an expiry/refund, or a sender cancellation/refund without polling. There are exactly **three terminal events**: | `event` | Emitted when | | - | - | | `claimed` | The recipient claimed the link **and** the payout transaction was persisted on-chain. | | `expired` | The link expired unclaimed **and** the refund transaction succeeded on-chain. | | `cancelled` | The **sender cancelled** (claimed back) a funded, unclaimed link **and** the refund transaction succeeded on-chain. | > ⚠️ **`cancelled` is new.** Earlier versions of this document stated that > there is **no** `cancelled` event — that is **no longer true**. Sender > cancel / claim-back is live (see the > [Cancel (Claim-Back) API](/api-reference/claim-links/cancel-auto-payout)), > and its refund settles through the same path as an expiry refund, so it > emits the same payload shape with `refund_tx_hash` set. **If your handler > was written against the old two-event contract, it must now tolerate a > third `event` value** — do not treat an unknown event as an error. > > **The callback fires after on-chain settlement, not on the status > change alone.** A link whose status becomes expired or cancelled does > **not** emit its event until the refund succeeds — if a refund is still > pending or has failed, no callback is sent (yet). Do not treat > "status = cancelled" as equivalent to "a `cancelled` webhook will > arrive"; reconcile via the Claim Link status API for the authoritative > state. The claim webhook reuses the **same HMAC-SHA256 request-signing scheme** as every other AllScale webhook — see [Webhook Callback Signing & Payload Guide](/webhooks/checkout-webhook) for the canonical-string construction, header definitions, and verification flow. This document covers only what is **specific to the Claim Link webhook**: which links emit it, the payload shape, and the delivery/retry behavior. *** ## Which links emit a webhook A callback is sent **only** when a webhook URL is configured for the link: | Link type | Webhook URL source | Payload identifier | Events | | - | - | - | - | | **Batch-created links** | `webhook_url` on the batch | `batch_id` | `claimed`, `expired` | | **Merchant single-create (auto-payout) links** | `claim_link_webhook_url` on your store | `store_id` | `claimed`, `expired`, `cancelled` | | In-app single links | — (never emit) | — | — | Exactly **one** of `batch_id` / `store_id` is populated in each payload, identifying how the link was created. The store-level `claim_link_webhook_url` must be an **`https://`** URL (plain `http://` is accepted only in the sandbox environment). > **`cancelled` only ever carries `store_id`.** A batch sub-link cannot be > cancelled individually (its funds are pooled and returned through the > batch's aggregate refund flow), so a `cancelled` event is never emitted > for a batch link — `batch_id` is always `null` on a `cancelled` payload. The callback is signed with the **same store credentials** (`api_key` + `api_secret`) that authenticated the create request — i.e. the store that owns the batch or the single-create link. *** ## Webhook Request ### Method ```http theme={null} POST ``` ### Content-Type ```http theme={null} application/json ``` ### Required Headers Identical to all AllScale webhooks (see the signing guide): | Header | Description | | - | - | | X-API-Key | Your store's API key | | X-Webhook-Id | Unique webhook ID (dedupe key) | | X-Webhook-Timestamp | Unix timestamp (seconds) | | X-Webhook-Nonce | Unique per-request nonce | | X-Webhook-Signature | `v1=` | The signature is computed over the canonical string `allscale:webhook:v1\nPOST\n\n\n\n\n\n`, signed with your `api_secret`. **Always verify the signature against the raw request-body bytes before parsing the JSON.** *** # Webhook Payload The request body is **exactly** the following JSON structure. All money values are **decimal strings in token units** (never floats). ## JSON Field Definitions | Field | Type | Required | Description | | - | - | - | - | | webhook\_id | string | ✅ | Unique webhook ID; must match `X-Webhook-Id`. Use it for idempotency (see below). | | event | string | ✅ | `"claimed"`, `"expired"`, or `"cancelled"`. Tolerate unknown values — new terminal events may be added. | | claim\_link\_id | string | ✅ | The Claim Link this event is about. | | occurred\_at | string | ✅ | Time AllScale **generated this callback**, ISO-8601 UTC with `Z` suffix (e.g. `"2026-07-14T03:21:07Z"`). This is the enqueue time, not the exact on-chain event time — on a retry or catch-up re-delivery it can be later than the actual claim/refund. For the precise on-chain moment, use the transaction hash. | | amount | string | ✅ | Claim/refund amount as a **decimal string** in token units (e.g. `"12.50"`). | | token\_symbol | string | ✅ | Stablecoin symbol, e.g. `"USDT"` / `"USDC"`. | | batch\_id | string \| null | ➖ | Set for batch-created links; `null` otherwise. Exactly one of `batch_id` / `store_id` is non-null. | | store\_id | string \| null | ➖ | Set for merchant single-create (auto-payout) links; `null` otherwise. | | reference\_id | string \| null | ➖ | Your per-link reference id, if one was supplied at create time; `null` otherwise. | | claim\_tx\_hash | string \| null | ➖ | On-chain payout tx hash. Set when `event = "claimed"`; `null` for `expired` / `cancelled`. | | refund\_tx\_hash | string \| null | ➖ | On-chain refund tx hash. Set when `event = "expired"` **or** `"cancelled"` (both settle via a refund); `null` for `claimed`. | > **Null keys are always present.** Fields that do not apply to a given > event/link type are serialized as `null` (not omitted). Your parser > should tolerate `null` for every optional field above. The HMAC > covers the exact bytes sent, so do not re-serialize before verifying. ## Example — `claimed` (merchant single-create link) ```json theme={null} { "webhook_id": "a3f8c1e2-...-uuid5", "event": "claimed", "claim_link_id": "clk_9f2b", "occurred_at": "2026-07-14T03:21:07Z", "amount": "12.50", "token_symbol": "USDT", "batch_id": null, "store_id": "store_001", "reference_id": "order_8899", "claim_tx_hash": "0xabc...", "refund_tx_hash": null } ``` ## Example — `expired` (batch-created link) ```json theme={null} { "webhook_id": "b7d4e0a1-...-uuid5", "event": "expired", "claim_link_id": "clk_1a04", "occurred_at": "2026-07-21T00:00:00Z", "amount": "12.50", "token_symbol": "USDT", "batch_id": "batch_2025_q3", "store_id": null, "reference_id": null, "claim_tx_hash": null, "refund_tx_hash": "0xdef..." } ``` ## Example — `cancelled` (merchant single-create link) Emitted after you called the [Cancel (Claim-Back) API](/api-reference/claim-links/cancel-auto-payout) and the refund settled on-chain. Note `batch_id` is always `null` here, and `refund_tx_hash` is set exactly as for `expired`. ```json theme={null} { "webhook_id": "c2e9f5b3-...-uuid5", "event": "cancelled", "claim_link_id": "clk_9f2b", "occurred_at": "2026-07-15T09:14:22Z", "amount": "12.50", "token_symbol": "USDT", "batch_id": null, "store_id": "store_001", "reference_id": "order_8899", "claim_tx_hash": null, "refund_tx_hash": "0x123..." } ``` *** ## Idempotency & Dedupe `webhook_id` is **stable and deterministic** for a given `(claim_link_id, event)` pair — every retry and every at-least-once re-delivery of the same event carries the **same** `webhook_id`. * Treat `webhook_id` as the dedupe key: record processed IDs and ignore repeats. * Because delivery is **at-least-once**, you **will** occasionally receive the same event more than once (e.g. after a retry or a catch-up sweep). Idempotent handling is required. *** ## Delivery & Retry Behavior * **At-least-once, best-effort.** The first delivery attempt is synchronous; on any non-`200` response (or timeout / connection error) AllScale schedules **up to 35** exponential-backoff retries. * **Retry window.** Backoff grows (\~5s, 10s, 20s, 40s, 80s) then caps at 120s per attempt, giving a real delivery window of roughly **30 minutes (with jitter) up to \~1 hour** — enough to survive a brief outage or deploy on your side. * **No replay after exhaustion.** Once the retries are exhausted the job is dead-lettered and **not** re-delivered by any drain/replay mechanism. If your endpoint is down for longer than the retry window, you will miss that callback — reconcile via the Claim Link status API rather than relying solely on the webhook. * **Missed-`expired` catch-up.** For **batch** links, AllScale runs a catch-up sweep that re-enqueues `expired` webhooks that were missed within the last **7 days**. This is an additional at-least-once path (hence the dedupe requirement above); it does **not** cover the `claimed` or `cancelled` events, nor store single-create links. Because `cancelled` is store single-create only, it has **no** catch-up path — if your endpoint is down past the retry window you will miss it, so reconcile rather than relying on the callback alone. * **Request timeout.** Each attempt uses a **5-second** timeout; respond quickly (return `200` and process asynchronously if needed). *** ## Response Expectations Your endpoint should return: * `200 OK` — the callback is considered delivered; no retry. * Any non-`200` — treated as a failure; the callback is retried per the policy above. *** ## Best Practices ✅ Verify `X-Webhook-Signature` against the **raw body bytes** before processing\ ✅ Dedupe on `webhook_id` — you will receive duplicates\ ✅ Branch on `event` (`claimed` / `expired` / `cancelled`) and read the matching `*_tx_hash` (`claim_tx_hash` for `claimed`, `refund_tx_hash` for `expired` and `cancelled`)\ ✅ Treat an **unrecognized** `event` as a no-op you ack with `200`, not as an error — new terminal events may be added (as `cancelled` was)\ ✅ Parse `amount` with a Decimal type, not a float\ ✅ Return `200` fast; do heavy work asynchronously\ ✅ Reconcile against the Claim Link status API for anything longer than the \~1h retry window\ ❌ Never log `api_secret` or signatures *** End of Document