PayclaveDocs

Payclave developers

Recurring invoices and subscriptions

Create schedules, understand UTC billing cycles, and pause or cancel subscriptions.

Subscriptions schedule invoices

A Payclave subscription creates an invoice each billing cycle. The customer opens hosted checkout and explicitly pays from their wallet each time. Payclave stores no authority to charge that wallet automatically. Use each cycle's signed invoice.paid event to activate or renew the corresponding service period.

Recurring billing is available only to enabled merchants. It also requires itemized invoice access. Subscription routes require a secret API key; publishable and restricted agent keys cannot manage schedules. Check availability before offering subscription creation in your product.

Create a schedule

Choose a weekly, monthly, or yearly cadence and a future UTC anchor. Provide a customer email and an explicit active settlement wallet in the invoice template. Omit issue, send, and dueAt from the template; each cycle issues its invoice and queues its email.

requestKey identifies one intended subscription. Reuse the identical key and body after a timeout, and persist the returned subscription ID and version. Keep your own customer and service-period records linked to the resulting invoice IDs.

bash
curl https://api.payclave.com/v1/subscriptions \  -H "Authorization: Bearer sk_test_..." \  -H "Content-Type: application/json" \  -d '{    "requestKey": "customer_123_monthly_v1",    "cadence": "monthly",    "anchor": "2027-01-31T12:00:00Z",    "template": {      "walletId": "YOUR_TEST_WALLET_ID",      "customer": { "email": "customer@example.com" },      "lines": [{ "description": "Monthly service", "quantity": "1", "unitAmount": "25.00" }]    }  }'

Calendar and missed cycles

All boundaries are calculated in UTC from the original anchor. Weekly means seven calendar days. Monthly and yearly schedules clamp to a valid day in short months: a January 31 anchor reaches February's last day, then returns to March 31. Daylight-saving changes do not move the UTC time.

After downtime, only the latest due cycle is issued; older missed cycles are skipped. Resuming a paused subscription schedules the first strictly future boundary. Payclave does not send a burst of invoices for every elapsed period.

Pause, resume, and cancel

Read the current subscription and send its version with action pause, resume, or cancel. Re-read after a version conflict. Immediate cancellation stops future invoice creation. endOfPeriod:true cancels at the next scheduled boundary instead of issuing that boundary's invoice; cancelled subscriptions cannot resume.

Pause and cancellation leave existing invoices payable unless you close their collection separately. These actions do not refund past payments. To change the price, cadence, customer, or wallet, cancel the old schedule and create an explicit replacement.

bash
curl -X POST https://api.payclave.com/v1/subscriptions/YOUR_SUBSCRIPTION_ID \  -H "Authorization: Bearer sk_test_..." \  -H "Content-Type: application/json" \  -d '{ "action": "pause", "version": 1 }'

Resolve attention states

A missing or disabled wallet, revoked live access, suspended merchant, or invalid invoice configuration can stop cycle creation and require attention. Read the subscription detail and latest invoice, fix the cause, then resume explicitly. The schedule does not silently switch to a new default wallet.

Keep email delivery and payment confirmation separate. An invoice can be issued while its email delivery needs recovery. Neither schedule creation nor an email delivery means the customer has paid.

On this page