UniversalEscrow
DocumentationAPI reference

Any language

The SDK is TypeScript, but the platform is HTTPS and JSON. A marketplace written in PHP, Python, Ruby, Java, .NET or Go integrates exactly the same way, with the HTTP client it already has. Everything the SDK does is on this page.

What you build, and what you don't

Every screen a buyer or a seller sees is hosted by us: the wallet verification page, the checkout, the release page. They open from one script tag as popups over your page, or as plain links, so they work on any site whatever it is written in. Your backend does three things:

  1. Makes a handful of authenticated JSON requests (below).
  2. Stores the ids it gets back: swal_… on the seller, esc_… on the order or job.
  3. Receives webhooks on one endpoint and checks their signature. That check is ten lines in any language and the webhooks guide has it in Node.js, Python and PHP.

No smart contracts, no blockchain library. Your server never signs a transaction or holds a key to anyone's funds. Wallets are connected and transactions are signed on the hosted pages, in the buyer's or seller's own wallet.

The whole integration, step by step

The marketplace flow, with the request behind each step and the SDK method that would make it. Paths are relative to your $ESCROW_API_BASE.

StepRequestSDK equivalent
Seller adds a payout walletPOST /seller-wallet-verifications with a returnUrl, then render the returned url into the verify button on the seller's pagesellerWallets.createVerification
Seller has signedWebhook seller_wallet.verified; store data.sellerWalletId (or poll GET /seller-wallet-verifications/{id})verifySignature
Buyer hires the sellerPOST /escrows with sellerWalletId (or POST /escrow-groups for milestones)escrows.create
Buyer paysNo request: redirect to checkoutUrl, or put the pay button on your page—
Payment confirmedWebhook escrow.funded to your endpoint; verify its signature, then mark the order paidverifySignature
Work deliveredSend the buyer links.release; webhook escrow.released when the seller is paidescrows.retrieve

Example: a freelance marketplace

These are the exact requests. Translate each curl into your language's HTTP client: a method, a URL, two or three headers and a JSON body.

Seller onboarding
# 1. Your server, when the seller clicks "Add payout wallet"
curl -sS -X POST "$ESCROW_API_BASE/seller-wallet-verifications" \
  -H "Authorization: Bearer $ESCROW_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{ "sellerReference": "seller_812", "returnUrl": "https://marketplace.example/settings/payouts" }'

# → { "id": "swv_01K6…", "status": "PENDING",
#     "url": "https://<checkout host>/verify-wallet#token=…", … }
# Save the id. Render url into the seller's own page (it is returned only once):
#   <script src="https://<checkout host>/embed/v1.js" async></script>
#   <div data-escrow-verify-wallet="<url>"></div>

# 2. Your webhook endpoint, once the seller has signed in the popup
#   { "type": "seller_wallet.verified",
#     "data": { "sellerWalletId": "swal_01K6…", "sellerReference": "seller_812", "address": "0x90F7…", … } }
# Verify the signature, then save sellerWalletId on the seller's profile.
# You never type their address. No webhook endpoint? Poll instead:
curl -sS "$ESCROW_API_BASE/seller-wallet-verifications/swv_01K6…" \
  -H "Authorization: Bearer $ESCROW_API_KEY"   # until "status": "VERIFIED"
Hiring
# 3. Your server, when the buyer accepts the seller's offer
curl -sS -X POST "$ESCROW_API_BASE/escrows" \
  -H "Authorization: Bearer $ESCROW_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: job-981-offer-3' \
  -d '{
    "amount": "250000000",
    "currency": "USDC",
    "sellerWalletId": "swal_01K6…",
    "externalReference": "job-981",
    "description": "Logo design",
    "successUrl": "https://marketplace.example/jobs/981/paid",
    "cancelUrl": "https://marketplace.example/jobs/981"
  }'

# → { "id": "esc_01J8…", "status": "CREATED",
#     "checkoutUrl": "https://<checkout host>/checkout/esc_01J8…",
#     "links": { "release": "…", … }, … }
# Save the id with the job. No buyer wallet needed: whoever pays becomes the buyer.
HTML
<!-- 4. The job page your template renders for the buyer — any templating language -->
<script src="https://<checkout host>/embed/v1.js" async></script>
<div data-escrow-checkout="esc_01J8…" data-label="Pay with crypto"></div>

Then book the payment when escrow.funded reaches your webhook endpoint, never on the buyer's return to successUrl. See verified seller wallets, accept a payment and the pay button for every field and option.

What the SDK does for you, done by hand

Authentication

Every request carries Authorization: Bearer <API key>. Keep the key on your server: in an environment variable or a secrets store, never in a page, an app or a repository.

JSON and money

Send Content-Type: application/json. Amounts are atomic-unit strings: USDC has 6 decimals, so "250000000" is 250 USDC. Never send a float — compute in integers or your language's decimal type.

Safe retries

Send an Idempotency-Key (8–255 characters) on every create. If a request times out, retry with the same key and the same body: you get the original response instead of a second escrow.

Errors

A failure is a non-2xx status with { "error": { "code", "message", "requestId", … } }. Branch on code, log requestId, and on a 429 wait Retry-After seconds. Every code is in errors and limits.

Webhook signatures

HMAC-SHA256 of "<t>.<raw body>" with your endpoint secret, compared in constant time, rejected if t is more than 5 minutes old. Use the raw body: a parsed and re-encoded body will not match. Code and a test vector.

Or generate a typed client

The full API description is published as OpenAPI, the same document the API reference is built from. Any OpenAPI generator turns it into a client with typed requests and responses in your language:

Shell
curl -sS https://<public site>/openapi.json -o openapi.json

# -g php | python | ruby | java | csharp | go | kotlin | rust | …
docker run --rm -v "$PWD:/local" openapitools/openapi-generator-cli:v7.10.0 generate \
  -i /local/openapi.json -g python -o /local/escrow-client
  • Generated method names come from the document's operation ids, so EscrowsController_create becomes escrows_controller_create in Python. Each generator names them its own way.
  • Check the generator's minimum language version against your runtime. On an older runtime, plain requests as above are the simpler route.
  • Verify webhooks by hand, not with a generated model: the signature covers the raw body, which a model has already parsed.

Next