Skip to content

Service API

The Service API is called by your application backend to create payment orders and query their status. All requests must be authenticated with a signed JSON body.

Base path: /api/v1/service
Authentication: Ocrch-Signature header — see Authentication


Create a new pending payment order.

Request headers:

HeaderValue
Content-Typeapplication/json
Ocrch-Signature{timestamp}.{base64_hmac}

Request body:

{
"order_id": "your-order-reference-123",
"amount": "19.99",
"webhook_url": "https://your-app.example.com/webhooks/ocrch",
"expecting_wallet_address": null,
"blockchain": null,
"stablecoin": null
}
FieldTypeRequiredDescription
order_idstringYesYour merchant-assigned order identifier. Stored as-is; not interpreted by Ocrch.
amountdecimal stringYesPayment amount in the stablecoin’s base unit (e.g. "19.99" for $19.99 USDT).
webhook_urlstringYesURL that Ocrch will POST webhook events to when the order status changes.
expecting_wallet_addressstring | nullNoIf set, Ocrch will only match transfers originating from this address.
blockchainstring | nullNoPre-select a blockchain (e.g. "eth"). The user cannot change it on the checkout page.
stablecoinstring | nullNoPre-select a stablecoin (e.g. "USDT"). The user cannot change it on the checkout page.

Response — 201 Created:

{
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"merchant_order_id": "your-order-reference-123",
"amount": "19.99",
"status": "pending",
"created_at": 1711900800
}
FieldTypeDescription
order_idUUID stringInternal Ocrch ID — use this to build the signed checkout URL.
merchant_order_idstringEchoed back from your order_id field.
amountdecimal stringPayment amount.
statusstringAlways "pending" for newly created orders.
created_atintegerUnix timestamp of order creation.

Blockchain identifiers:

ValueChain
"eth"Ethereum
"polygon"Polygon
"base"Base
"arb"Arbitrum One
"op"Optimism
"linea"Linea
"avaxc"Avalanche C-Chain
"tron"Tron

Stablecoin identifiers:

ValueCoin
"USDT"Tether
"USDC"USD Coin
"DAI"Dai

Example (TypeScript):

import { createHmac } from "node:crypto";
async function createOrder(orderId: string, amount: string, webhookUrl: string) {
const payload = {
order_id: orderId,
amount,
webhook_url: webhookUrl,
expecting_wallet_address: null,
blockchain: null,
stablecoin: null,
};
const timestamp = Math.floor(Date.now() / 1000).toString();
const json = JSON.stringify(payload);
const sig = createHmac("sha256", process.env.MERCHANT_SECRET!)
.update(`${timestamp}.${json}`)
.digest("base64");
const res = await fetch("https://checkout-api.example.com/api/v1/service/orders", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Ocrch-Signature": `${timestamp}.${sig}`,
},
body: json,
});
if (!res.ok) throw new Error(await res.text());
return res.json();
}

Get the current status of an existing order.

Request headers:

HeaderValue
Content-Typeapplication/json
Ocrch-Signature{timestamp}.{base64_hmac}

Request body:

{
"order_id": "550e8400-e29b-41d4-a716-446655440000"
}
FieldTypeRequiredDescription
order_idUUID stringYesThe internal Ocrch order ID returned when the order was created.

Response — 200 OK:

Same structure as the create order response.

{
"order_id": "550e8400-e29b-41d4-a716-446655440000",
"merchant_order_id": "your-order-reference-123",
"amount": "19.99",
"status": "paid",
"created_at": 1711900800
}

Error responses:

StatusBodyCause
401 Unauthorizedmissing Ocrch-Signature headerMissing or invalid auth
401 Unauthorizedsignature verification failedHMAC mismatch
404 Not Foundorder not foundNo order with that UUID
500 Internal Server Errorinternal server errorDatabase error

Backend Ocrch Server
| |
| POST /api/v1/service/orders |
| Ocrch-Signature: ts.hmac |
| { order_id, amount, ... } |
| ───────────────────────────────> |
| | Verify HMAC
| | Insert order (status=pending)
| 201 Created |
| { order_id: UUID, ... } |
| <─────────────────────────────── |
| |
| (build signed checkout URL) |
| (redirect user to checkout) |
| |
| POST /api/v1/service/orders/status
| { order_id: UUID } |
| ───────────────────────────────> |
| 200 OK { status: "paid", ... } |
| <─────────────────────────────── |