This recipe covers the MVP subscription flow: save a card with a SetupIntent, attach it to a customer, and create a subscription that auto-pays each cycle.Documentation Index
Fetch the complete documentation index at: https://docs.fluveo.com/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- A Fluveo API key for a verified merchant (see Onboarding docs).
- A Stripe-backed PSP connection on the merchant (defaults to the platform payfac in MVP, so no per-merchant Connect setup is required).
1. Create the customer
id as cus_xxx.
2. Create and confirm a SetupIntent
client_secret. Pass it to your frontend; on
confirmation the PM is attached to the customer.
payment_method=pm_xxx, now attached.
3. Create a recurring price
4. Create the subscription
"status": "active" and latest_invoice references the paid invoice.
If the card declines, the subscription stays incomplete and Fluveo’s
Temporal billing workflow retries at the configured dunning cadence
(days 1, 3, 5, 7).
5. Handle renewals
You don’t have to do anything. Fluveo runs the billing workflow atcurrent_period_end:
- Create a new invoice for the next period.
- Finalize → pay using
default_payment_method. - On success, move
current_period_{start,end}forward. - On failure, transition
past_dueand start dunning.
invoice.paid— renewal succeededinvoice.payment_failed— dunning startedsubscription.updated— status changed (past_due,unpaid)
Common errors
| Code | Status | Meaning |
|---|---|---|
parameter_missing | 400 | default_payment_method required for charge_automatically + no trial |
unsupported_psp_capability | 422 | The resolved PSP can’t do recurring for (currency, paymentMethodTypes) |
invalid_price | 422 | Price has unit_amount=null (metered pricing isn’t MVP) |
payment_failed | 402 | payment_behavior=error_if_incomplete and the card declined |