Skip to main content
POST
cURL
Create one credit pack without replacing other catalog items. An add-on is a one-time Stripe Checkout purchase that grants a fixed number of credits after payment. It can top up a customer who already has a plan.

Set the pack value

Set type to credit_pack, creditAmount to a positive integer, and priceCents to a positive integer in USD cents. For example, creditAmount: 50 and priceCents: 500 sells 50 credits for $5.00. The ID is a stable API identifier with letters, numbers, underscores, or hyphens (up to 100 characters); the name is a display label. The response contains the created item and changed: true. Another active add-on with the same ID returns 409 already_exists. Credit-pack prices are created for each hosted Checkout session rather than synced as recurring Stripe catalog prices.

Sell a pack

Create or find the customer, then call Attach a plan or add-on with addOnId and open its checkoutUrl. The purchase remains pending_checkout until Stripe confirms a paid session. Ledger grants the Checkout’s credit amount once and shows the purchase in the customer dashboard. Repeating the same attach request while Checkout is open returns the existing link; a different pack can return 409 purchase_pending. The price and credit amount are fixed for an open Checkout. Update an add-on returns 409 purchase_pending if you try to change either value while a purchase is pending. When Stripe’s signed checkout.session.expired event reaches Ledger, the pending purchase is removed and the edit can be retried. A browser cancel redirect alone does not expire the Stripe session. Archive an add-on hides it from new purchases while keeping purchase history. See Customers for the complete top-up flow.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
id
string
required
Required string length: 1 - 100
Pattern: ^[a-zA-Z0-9_-]+$
name
string
required
Required string length: 1 - 120
type
enum<string>
required
Available options:
credit_pack
creditAmount
integer
required
Required range: x <= 2147483647
priceCents
integer
required
Required range: x <= 2147483647

Response

AddOn created

item
object
required
changed
boolean
required