Server-to-Server Integration

The simplest integration — one API call gets everything needed to pay. Used by AI agents, server-to-server, and backend-only flows.

One-Step Flow

Pass sourceChain during session creation to get deposit address in a single call:
curl -X POST https://api.stableyard.fi/v2/sessions \
  -H "Authorization: Bearer sy_secret_*" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2000000,
    "destination": "shop@stableyard",
    "sourceChain": "polygon",
    "executionMode": "boosted"
  }'
Response includes deposit.address — send funds there, then submit the tx hash:
curl -X POST https://api.stableyard.fi/v2/sessions/ses_abc/submit-tx \
  -H "Authorization: Bearer sy_secret_*" \
  -H "Content-Type: application/json" \
  -d '{ "txHash": "0x...", "chain": "polygon" }'
Wait for payment.settled webhook or poll the session status.

Complete Flow

1. POST /v2/sessions { amount, destination, sourceChain }
   → Returns session + deposit address (one call)

2. Send USDC to deposit.address

3. POST /v2/sessions/:id/submit-tx { txHash, chain }
   → Status: pending

4. Wait for webhook: payment.settled
   → Or poll: GET /v2/sessions/:id until settled

5. Done. Merchant received funds on their settlement chain.

Webhook Handling

# Register webhook
curl -X POST https://api.stableyard.fi/v2/webhooks \
  -H "Authorization: Bearer sy_secret_*" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-server.com/webhooks",
    "events": ["payment.settled", "payment.failed"]
  }'
Verify HMAC-SHA256 signature on incoming webhooks using the secret returned during registration.