customerId is your own ID for them, so you never store a Ledger ID. Create the customer when they sign up, and attach their first plan:
- It’s safe to repeat.
createOrGetCustomerreturns the existing customer if there is one, so you can also call it lazily, before a customer’s firstcheck. - Creating grants nothing. Credits come from attaching a plan or buying a pack.
- IDs are 1 to 255 characters, and belong to one environment: the same
customerIdin Sandbox and Live is two separate customers. A Sandbox key asking for a Live customer gets404 customer_not_found. - Ledger creates the Stripe customer when it first needs one. To reuse one you already have, for example when migrating from Stripe, link it first.
Read a customer
getCustomer returns the balance and current plan. Balances explains the fields.
Delete a customer
DELETE /v1/customers removes a customer; the SDKs don’t have it yet. In Sandbox it removes their usage events too, so you can start over cleanly. In Live the usage events stay as the record of what the customer used.