WeTakeStables

API Reference

Everything you need to accept stablecoin payments. Base URL: https://wetakestables.shop

How It Works Auth Checkout Orders Webhooks Widget Invoices

Authentication

All authenticated endpoints require a Bearer token in the Authorization header. Get your token from the dashboard or login response.

Authorization: Bearer your-merchant-token
POST /api/v1/signup

Create a new merchant account. Returns a merchant ID and sends a verification email.

Body:

{
  "email": "merchant@example.com",
  "companyName": "My Store",
  "contactName": "John",
  "password": "min8chars",
  "plan": "FREE"
}

Response:

{
  "success": true,
  "message": "Check your email for the verification code.",
  "merchantId": "cmXXXXXXXX"
}
POST /api/verify-email

Verify email with the 6-digit code. Auto-activates FREE tier accounts.

{ "email": "merchant@example.com", "code": "123456" }

Response:

{ "success": true, "token": "your-bearer-token", "merchantId": "cmXXXX", "isActive": true }
POST /api/login

Login with email + password. Returns a Bearer token for API calls.

{ "email": "merchant@example.com", "password": "your-password" }

Response:

{ "success": true, "token": "your-bearer-token", "merchantId": "cmXXXX", "isActive": true }
POST /api/forgot-password

Request a password reset code. Sends a 6-digit code to the email.

{ "email": "merchant@example.com" }
POST /api/reset-password

Reset password using the 6-digit code from email.

{ "email": "merchant@example.com", "code": "123456", "newPassword": "min8chars" }

Checkout (Create Payment)

This is the main endpoint your checkout flow calls. Creates an order and returns a payment address.

POST /api/embed/checkout

Create a payment order. No auth required — uses merchantId to identify the account.

Body:

{
  "merchantId": "your-merchant-id",    // Required
  "amount": 99.99,                     // Required — in USD
  "chain": "BASE_MAINNET",            // Optional — customer picks if omitted
  "token": "USDC",                    // Optional — defaults to USDC
  "customerEmail": "buyer@email.com", // Optional
  "customerWallet": "0xabc...",       // Optional — customer's wallet for precise matching
  "productName": "Order #1234"        // Optional
}

Response:

{
  "success": true,
  "order": {
    "id": "cmXXXXXX",
    "amount": 99.99,
    "token": "USDC",
    "chain": "BASE_MAINNET",
    "paymentAddress": "0x...",    // Send stablecoins HERE
    "expiresAt": "2026-03-28T..."
  }
}
Flow: Your checkout calls this → customer sends stablecoins to paymentAddress → we detect the transfer on-chain → webhook fires to your server → order confirmed.

Orders

GET /api/orders

List your orders. Requires Bearer token. Returns only orders belonging to the authenticated merchant.

Authorization: Bearer your-token

// Response:
{ "orders": [...], "total": 42, "page": 1, "limit": 50 }
GET /api/orders/:orderId

Get a single order by ID. Returns full order details including transaction info.

POST /api/orders/:orderId/confirm

Manually confirm an order (admin). Normally handled automatically by on-chain detection.

Webhooks

Configure your webhook URL in the dashboard or via the agent. We POST to your endpoint when payment events occur.

How It Works

When a customer pays, we send a POST request to your server so you know it happened. You don't need to check — we tell you.

Your webhook URL: https://YOUR-DOMAIN/api/webhooks/stablepay

Set this in your dashboard or tell the AI agent your domain and it'll configure everything + write the handler code for you.

Example: Next.js Webhook Handler

// pages/api/webhooks/stablepay.js
export default async function handler(req, res) {
  if (req.method !== 'POST') return res.status(405).end();

  const { event, orderId, amount, txHash, chain } = req.body;

  if (event === 'order.confirmed') {
    // Payment confirmed! Do your thing:
    // - Update your database
    // - Send confirmation email
    // - Fulfill the order
    console.log(`Payment: $${amount} on ${chain}, tx: ${txHash}`);
  }

  res.status(200).json({ received: true });
}

Webhook Payload

We POST this JSON to your webhook URL:

{
  "event": "order.confirmed",           // Event type
  "orderId": "cmXXXXXX",
  "merchantId": "cmXXXXXX",
  "amount": "99.99",
  "token": "USDC",
  "chain": "BASE_MAINNET",
  "txHash": "0xabc...",
  "customerEmail": "buyer@email.com",
  "status": "CONFIRMED",
  "timestamp": "2026-03-28T12:00:00Z"
}

Events:

  • order.created — New payment order created
  • order.confirmed — Payment confirmed on-chain
  • order.refunded — Refund processed
  • invoice.paid — Invoice payment received
  • receipt.sent — Receipt email delivered
Your webhook should respond with 200 OK. We retry up to 3 times with exponential backoff on failure.

How It Works

Setup (3 steps)

1
Create wallet — bring your own (MetaMask, Phantom) or we create a managed one instantly. One address works on all EVM chains.
2
Add your domain — we auto-configure your webhook URL and redirect URLs. AI agent handles everything.
3
Add the widget — one script tag + one line of code. Customers can pay immediately.

Payment Flow

Customer clicks "Pay with Crypto" on your site
        |
StablePay checkout opens (modal or hosted page)
        |
Customer picks chain (Base, Ethereum, Polygon, Arbitrum, Solana)
        |
Customer picks stablecoin (USDC, USDT, EURC — varies by chain)
        |
Customer picks HOW to pay:
   +-- Connect Wallet — MetaMask/Rainbow/Coinbase/Phantom, one-click approve
   +-- QR Code — scan with mobile wallet app
   +-- Copy Address — paste into any wallet or exchange
        |
Payment lands in YOUR wallet (direct, non-custodial)
        |
Our scanner detects the on-chain transfer (15-30 seconds)
        |
Webhook fires to your server: { event: "order.confirmed", amount, txHash }
        |
Customer redirected to your success page

What Your Customers See

The checkout widget gives every customer 3 ways to pay — no config needed:

Connect Wallet

MetaMask, Rainbow, Coinbase Wallet, Phantom. One-click approve. Best for desktop.

QR Code

Scan with any mobile wallet app. Pre-filled transaction. Best for phones.

Copy Address

Copy wallet address + exact amount. Send from any wallet or exchange (Coinbase, Binance).

Customers choose their chain and stablecoin. The widget shows only what you have configured. If you accept USDC on Base and Ethereum, that's what they see — nothing more.

Checkout Widget

Drop-in checkout for any website. One script tag + one function call.

Quick Start

<script src="https://wetakestables.shop/checkout-widget.js"></script>

<button onclick="StablePay.checkout({
  merchantId: 'your-merchant-id',
  amount: 49.99,
  onSuccess: (data) => {
    console.log('Paid!', data.orderId, data.txHash);
    window.location.href = '/thank-you';
  },
  onCancel: () => console.log('Cancelled')
})">Pay with Crypto</button>

All Options:

ParameterTypeDescription
merchantIdstringRequired. Your merchant ID.
amountnumberPayment amount in USD. Omit for dynamic.
productNamestringOptional. Shown in checkout UI.
customerEmailstringOptional. Pre-fill customer email.
allowedChainsstring[]Restrict chains: ["BASE_MAINNET", "ETHEREUM_MAINNET"]
allowedTokensstring[]Restrict tokens: ["USDC", "USDT"]
onSuccessfunctionCallback with { orderId, txHash, amount }
onCancelfunctionCalled when customer closes checkout

Supported Chains & Tokens

BaseUSDC, EURC
EthereumUSDC, USDT, EURC
PolygonUSDC, USDT
ArbitrumUSDC, USDT
SolanaUSDC, USDT

3 Payment Methods (built-in)

Every checkout automatically shows 3 ways to pay. No config needed.

Connect WalletOne-click with MetaMask, Rainbow, Coinbase, Phantom. Best for desktop.
QR CodeScan with any mobile wallet app. Best for phones.
Copy AddressCopy wallet address + amount. Send from any wallet or exchange.

Supported Wallets

EVM ChainsMetaMask, Rainbow, Coinbase Wallet, Rabby
SolanaPhantom, Solflare, Backpack

Multiple wallets? Customer sees a picker. Single wallet connects automatically.

Invoices & Receipts

POST /api/invoices

Create and send an invoice. Requires Bearer token.

{
  "merchantId": "cmXXXX",
  "customerEmail": "client@email.com",
  "customerName": "Client Name",
  "subtotal": 500.00,
  "lineItems": [
    { "description": "Web Design", "quantity": 1, "unitPrice": 500.00 }
  ],
  "dueDate": "2026-04-15",
  "notes": "Thank you for your business"
}
GET /api/receipts?merchantId=X

List all receipts. Auto-generated when payments confirm.

Pricing

Volume-based fees. No subscriptions. No setup costs.

Under $10k/month1.0%
$10k - $50k/month0.8%
$50k - $250k/month0.5%
$250k+/month0.3%

100% of payments go directly to your wallet. Fees are invoiced separately per billing cycle.