Show for
Subscriptions
Durable D1 subscription records. Due periods are sandbox MITs (cron or Run now) that reuse the hosted-pay CIT Network Transaction ID.
Runtime (2026-08-23): GET/POST /api/v1/subscriptions plus pause / resume / cancel / run-due. Amounts are cents. Due periods use an APT sandbox token from hosted pay (test cards). Cron and Run now share one captured charge per period, tagged MIT / recurring, and reuse the CIT sandbox NTID (not a live scheme ID). Re-login after deploy so session capabilities include subscriptions:read / subscriptions:write.
Creating a Subscription
const subscription = await apt.subscriptions.create({
customer_id: 'cus_abc123', // required D1 customer
plan_name: 'Pro Plan', // label, not a plans table
amount: 2900, // cents
currency: 'usd',
interval: 'MONTHLY', // WEEKLY | MONTHLY | YEARLY
});
// 201 = row saved. charged is false. No payment.* event.Lifecycle (status only)
ACTIVERecord is in force. Not proof a charge ran.
PAUSEDStatus paused. Not a void or refund.
CANCELLEDStatus cancelled. Not a refund.
PAST_DUEReserved. This slice does not set PAST_DUE from a failed charge.
Pause, resume, cancel
await apt.subscriptions.pause('sub_abc123');
await apt.subscriptions.resume('sub_abc123');
await apt.subscriptions.cancel('sub_abc123');Webhooks
Catalog may list subscription.* events. They are not emitted in this slice. Money-path payment.* / refund.* still come from transactions only.