The shortest path to money
This is the shortest path to money: define a recurring plan, create a customer, subscribe the customer to the plan, and read the invoice that the subscription generates. All three SDKs cover the same REST surface, so the steps line up one-to-one — only the idiom differs. Creating a subscription also generates its first invoice in the same call, so the last step is simply to fetch it back.Money is in minor units. Every amount is an integer in the currency’s
smallest unit —
2900 is $29.00. See
the concepts overview for the shared rules.1
Construct a client
Each SDK authenticates with your API key as a bearer token. Point the client at
your API host (
https://api.recurso.dev, or http://localhost:8080 for a local
make demo stack).The Python client is generated from the OpenAPI spec. Use
AuthenticatedClient,
give it the host without the /v1 prefix (operations add it), and call
per-operation sync(...) functions. Each sync returns either the parsed model
or an Error model — check with isinstance(result, Error) in production.2
Create a plan
A plan carries a
code, a billing interval, and a price in minor units. The
price currency is set here.3
Create a customer
A customer needs at minimum an email and a name. Billing address fields are
optional; the Node client defaults
country to US.4
Create a subscription
Subscribe the customer to the plan. This one call creates the subscription,
applies any coupon, and generates the first invoice.
5
Fetch the resulting invoice
The invoice list is newest-first. There is no server-side
customer_id
filter on the invoice list in any SDK, so pull a page and pick the invoice
belonging to your new subscription (or customer) client-side.invoice.total, amount_due, and every other amount are integers in minor
units. Convert to a decimal only for display.