Developers
Take stablecoin paymentsin three calls.
Your server creates an order. Your page opens the checkout. Uniform tells your server when it's paid. You always receive USDT on Whitechain, whatever the customer paid with.
- API base
https://uniform-blush.vercel.app/desk/v1- Widget
https://uniform-blush.vercel.app/widget.js
Overview
- Your server calls
POST /v1/orderswith your API key and gets apayUrl. - Your page opens that URL in Uniform's checkout card. The customer logs in with an email and pays with USDT on Whitechain or USDC on Base or Ethereum. They pay no gas.
- Uniform posts a signed
order.paidwebhook to your server. Ship the order when it arrives.
Your API key never reaches the browser, and the browser never decides that an order is paid. Only the signed webhook, or reading the order yourself, does.
Get your keys
Open the dashboard and connect the wallet you want to be paid to. If it isn't a merchant yet, give your business a name and sign one free message. You get two secrets, shown once:
API key | Creates orders. Send it as Authorization: Bearer …. Server only. |
Webhook secret | Starts with whsec_. Checks that a webhook really came from Uniform. |
Lost one? Replace it in Settings. The old one stops working at once.
Create an order
POST/v1/ordersAuth: API key
Call this from your server when the customer clicks pay.
| Field | Type | Notes |
|---|---|---|
amount | string | USDT as decimal text, up to 6 decimals: "12", "12.50". Above zero, at most 100. |
reference | string | Your own id for the sale, 1 to 200 characters. Comes back in every webhook. |
successUrl | string, optional | Where to send the customer after paying. https:// or http://. |
curl https://uniform-blush.vercel.app/desk/v1/orders \
-H "Authorization: Bearer $UNIFORM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": "12.50",
"reference": "order-1042",
"successUrl": "https://yourshop.com/thanks"
}'The answer is 201 Created. The customer has 30 minutes to pay before the order expires.
{
"orderId": "0x5f1c3e…9a2e",
"status": "created",
"amount": "12.500000",
"payUrl": "https://…/pay/0x5f1c3e…9a2e",
"expiresAt": 1794003600
}Show the checkout
Add the widget and point a button at an endpoint on your server that creates the order and answers { payUrl }. The checkout opens in a card over your page, the same in every browser. It closes by itself once paid.
<script src="https://uniform-blush.vercel.app/widget.js" defer></script>
<!-- POSTs to your endpoint, which answers { "payUrl": "…" } -->
<button data-uniform-checkout="/api/checkout"
data-uniform-body='{"cartId": "c_81"}'>
Pay with Uniform
</button>
<script>
document.addEventListener("uniform:paid", (event) => {
location.href = "/thanks?order=" + event.detail.orderId;
});
</script>uniform:paid | Fired on the button once paid. event.detail.orderId is the order. |
uniform:closed | The customer closed the card first. Uniform.checkout() rejects with Error("closed"). |
Treat uniform:paid as a hint for your page, not as proof. Ship on the webhook.
No JavaScript? Redirect the customer to payUrl instead. It works as a full page too.
Webhooks
Set your webhook URL in the dashboard under Settings. Uniform sends a POST with a JSON body when an order ends:
order.paid | You have the USDT. Ship the order. |
order.expired | Nobody paid in time, or a cross-chain payment ran out and went back to the customer. |
order.refunded | You refunded the full amount from the dashboard. |
POST /uniform/webhook
Content-Type: application/json
X-Uniform-Event: order.paid
X-Uniform-Signature: 7d0a3b…c41f
{
"type": "order.paid",
"orderId": "0x5f1c3e…9a2e",
"reference": "order-1042",
"amount": "12.500000",
"currency": "USDT",
"path": "crosschain",
"receipts": {
"customer": ["https://sepolia.basescan.org/tx/0x…"],
"settlement": "https://explorer.testnet.whitechain.io/tx/0x…"
}
}Check the signature
X-Uniform-Signature is the HMAC-SHA256 of the raw body, keyed with your webhook secret, as lowercase hex. Compute it over the bytes you received, before parsing, and compare in constant time.
# Check a signature by hand: the HMAC-SHA256 of the raw body, as lowercase hex.
printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$UNIFORM_WEBHOOK_SECRET" | awk '{print $2}'
# It must equal the X-Uniform-Signature header.Delivery
Answer with any 2xx within 10 seconds. Anything else is tried again after 10 seconds, 1 minute, 5 minutes and 30 minutes, then given up. You can resend any delivery from the dashboard's Webhooks tab. A delivery can arrive twice, so make your handler safe to run again for the same orderId.
Read an order
GET/v1/orders/{orderId}Auth: none
Anyone with the order id can read it; the id is random and unguessable. Use it to check an order's state yourself, for example on your thank-you page.
curl https://uniform-blush.vercel.app/desk/v1/orders/0x5f1c…9a2eOrder statuses
created | Made by your server. Nobody has paid. |
quoted | The customer opened the checkout and got a price. |
paying | The customer signed; the payment is on its way. |
source_locked | Cross-chain: the customer's USDC is locked on their chain. |
destination_locked | Cross-chain: the provider's USDT is locked for you on Whitechain. |
paid | You have the USDT. |
partially_refunded | You gave back part of it. |
refunded | You gave back all of it. |
expired | Nobody paid in time. Nothing moved. |
returned | Cross-chain ran out of time; the customer's money went back to them. |
Errors
Every error has the same shape and a matching HTTP status:
HTTP/1.1 400 Bad Request
{
"error": {
"code": "bad_amount",
"message": "amount must be USDT as decimal text with at most 6 decimals, like \"12.50\""
}
}| 401 | unauthorized | Missing or wrong API key. |
| 400 | bad_amount | Not decimal USDT, more than 6 decimals, or zero. |
| 400 | amount_too_large | Above the per-order limit (100 USDT). |
| 400 | bad_reference | Empty or longer than 200 characters. |
| 400 | bad_success_url | Not an http:// or https:// address. |
| 404 | not_found | No order with that id. |
Testing
Uniform runs on test networks today: Whitechain testnet, Base Sepolia and Ethereum Sepolia. Payments use test USDT and USDC with no real value. Free test USDC is at faucet.circle.com.
Want to see it whole first? The demo store uses exactly the calls above.
