You need a billing.io account with an API key. Use sandbox keys (
sk_test_) to test without real funds.
See Sandbox Testing to get started.Step 1: Create a Payment Method
A payment method defines how you receive crypto. You must create at least one before you can accept payments.Register your wallet
Add a wallet address to your organization through the dashboard at Settings > Wallets, or use the wallets API. Note the returned
wallet_id.Step 2: Create a Checkout
A checkout is a single payment session. It generates a deposit address that your customer sends crypto to. Checkouts expire after a configurable TTL (default: 30 minutes).deposit_address for the customer to pay:
Idempotency — Always include an
Idempotency-Key header (UUID format)
when creating checkouts. If your request is retried (e.g., due to a network
timeout), billing.io returns the original checkout instead of creating a
duplicate. Keys expire after 24 hours. See the
Idempotency guide for details.Step 3: Redirect the Customer
After creating a checkout, direct your customer to pay. You have two options:Option A: Hosted checkout page
Redirect the customer to the billing.io hosted checkout page:Option B: Embed in your UI
Use the checkout data from the API response to build your own payment UI. Display:- The
deposit_addressfor the customer to send crypto to - The
amount_atomic(token amount in smallest unit) oramount_usd - A QR code encoding the deposit address
- A countdown timer based on
expires_at
Step 4: Monitor Payment Status
Once the customer sends crypto, the checkout moves through these statuses:| Status | Description |
|---|---|
pending | Waiting for payment. No transaction detected yet. |
detected | Transaction seen on-chain but not yet confirmed. |
confirming | Block confirmations in progress. |
confirmed | Payment fully confirmed. This is a terminal state. |
expired | Checkout TTL exceeded without payment. Terminal state. |
failed | Unrecoverable error. Terminal state. |
Option A: Poll for status
Use the lightweight status endpoint for efficient polling. It returns apolling_interval_ms hint.
Option B: Use webhooks (recommended)
Webhooks push events to your server in real time, so you do not need to poll. See the Webhooks guide for full setup instructions.Step 5: Handle the checkout.completed Event
When a checkout is fully confirmed on-chain, billing.io fires acheckout.completed webhook event. This is the signal to fulfill the order.
Full webhook payload
Handling the event in your server
Complete Flow Summary
Next Steps
- Set up webhooks for real-time event notifications
- Test in sandbox before going live
- Use idempotency keys to safely retry requests
- Set up subscription billing for recurring payments