DocumentationSubscriptions

Subscriptions: recurring USDT and USDC invoices

A subscription is billed by invoice: every period Stablevoy makes an ordinary invoice on schedule and your shop sends it to the customer, who pays it like any other invoice. Nothing is taken from the customer's wallet without them.

Create a subscription

Send the price of one period and the interval: day, week, month or year, with intervalCount for longer periods (month and 3 is quarterly). paymentWindowMinutes is how long the customer has to pay each period invoice, from 15 minutes to 7 days and not longer than one period; left out, the store default invoice lifetime applies. End it after endsAfter periods or at endsAt, or leave both out for a subscription that runs until it is cancelled. The price can be in any of the supported currencies (amount with currency); each period invoice converts it at the rate of its own day.

curl -X POST https://api.stablevoy.com/v1/subscriptions \
  -H "Authorization: Bearer $STABLEVOY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: customer-77-gold" \
  -d '{
    "amountUsdCents": 1999,
    "interval": "month",
    "paymentWindowMinutes": 4320,
    "externalReference": "customer-77-gold"
  }'

When the first period starts now, its invoice is in the answer, the same view POST /v1/invoices returns. If that invoice is refused, for example because no network is available, the subscription is not created and the answer is that invoice error. With startsAt in the future, at most a year ahead, the first period starts later (a trial) and its invoice arrives by webhook. Send an Idempotency-Key header to retry safely.

Periods and their invoices

Period n starts at the first start plus n intervals, in UTC. Months and years follow the calendar: a subscription started on 31 January bills on 28 February, then on 31 March. When a period starts, its invoice is made within a minute and goes to your shop as subscription.invoice_created. Every period invoice is an ordinary invoice: it has its own deposit addresses, statuses and invoice.* events, and source says which subscription and period it belongs to. It counts against the store's open invoice limit like any invoice.

If the invoice of a period cannot be made, for example because the payout wallet is not confirmed or the store has too many open invoices, it is tried again every 10 minutes for 24 hours and your shop gets subscription.invoice_failed with the reason once for each new reason. The dashboard shows the reason on the period. After 24 hours the period counts as unpaid.

Build the payment link of each period invoice exactly as for your other invoices: from the invoice id and the payout wallets your shop confirmed, with the SDK's CheckoutLink (see payout wallets in payment links). The event also carries the plain checkoutUrl; it works, but the payment page then cannot check the payout wallet against what your shop confirmed.

Unpaid periods

When a period invoice expires unpaid, the subscription becomes past_due and Stablevoy makes a second invoice for the same period, valid until pastDueUntil, 7 days later. It goes to your shop as subscription.past_due, so you can send the customer a new link. A payment of either invoice of the period makes the subscription active again (subscription.recovered); the periods that started in between are skipped, not billed afterwards, and the next invoice comes on the next date of the schedule. Without a payment by pastDueUntil the subscription is cancelled with reason payment_failed.

Cancelling

POST /v1/subscriptions/{id}/cancel with atPeriodEnd: true stops further invoices and cancels the subscription when the current period ends; the current invoice stays payable. With atPeriodEnd: false it is cancelled now, together with its invoices still waiting for a first payment. Archiving the store cancels its subscriptions too. Money that still reaches an invoice later goes to your payout wallet as always.

Events

subscription.invoice_created, subscription.invoice_failed, subscription.past_due, subscription.recovered, subscription.cancelled and subscription.ended, signed and retried like every webhook. Every one carries the subscription; the ones about an invoice carry the invoice too. Payments still come as invoice.paid and the other invoice events.

{
  "id": "4f5a6b7c-8d9e-4f0a-8b1c-2d3e4f5a6b7c",
  "type": "subscription.invoice_created",
  "createdAt": "2026-12-16T12:00:30.000Z",
  "data": {
    "subscription": {
      "id": "7a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
      "status": "active",
      "externalReference": "customer-77-gold",
      "price": { "currency": "USD", "amount": 1999, "exponent": 2 },
      "interval": "month",
      "intervalCount": 1,
      "nextPeriodIndex": 3,
      "nextPeriodAt": "2027-01-16T12:00:00.000Z"
    },
    "invoice": {
      "id": "0b7e2f4c-8d1a-4c3b-9e5f-1a2b3c4d5e6f",
      "status": "awaiting_payment",
      "amountUsdCents": 1999,
      "expiresAt": "2026-12-19T12:00:30.000Z",
      "depositAddresses": [
        { "network": "base", "address": "0x1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b", "payoutAddress": "0x5cc5bc5cc5bc5cc5bc5cc5bc5cc5bc5cc5bc5cc5", "amountDueUsdCents": 1999 }
      ],
      "source": { "kind": "subscription", "subscriptionId": "7a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d", "periodIndex": 2, "periodAttempt": 1 },
      "checkoutUrl": "https://stablevoy.com/pay/?i=0b7e2f4c-8d1a-4c3b-9e5f-1a2b3c4d5e6f"
    }
  }
}

If your webhook endpoint is paused, the events wait for it like all others; the dashboard shows the payment links of the periods in the meantime.

Limits and rules

The price of a period must fit the store's invoice range at creation, and each period invoice checks it again at its own rate. A return URL must be a page of the store website, as for invoices. Your shop shows the customer the terms of the subscription and keeps them; Stablevoy bills on the schedule you set and never charges a wallet by itself.

Subscriptions need a store whose webhooks go to your own code. A store connected to the WooCommerce, Easy Digital Downloads or WHMCS plugin bills no subscriptions, because the plugins do not handle them yet, and a plugin cannot be connected to a store that bills running subscriptions. Use a separate store for each.