Products and pricesexperimental
What you sell, and what it costs, once or every period.
Experimental
403 Feature Not Enabled, it is not turned on for your business yet; ask us to enable it. Fields and behaviour can still change, so pin your SDK version and watch the changelog.A product is what you sell. A price is an amount for it, either once or on a schedule.
const product = await cambill.products.create({ name: "Hosting", external_id: "sku_hosting" })
const once = await cambill.prices.create({ product: product.id, currency: "USD", unit_amount: 1000 })
const monthly = await cambill.prices.create({
product: product.id,
currency: "USD",
unit_amount: 900,
type: "recurring",
interval: "month", // day | week | month | year
interval_count: 1,
})A price never changes
Its amount and currency are fixed. To charge more, create a new price and archive the old one. That is what keeps old invoices and running subscriptions true.
await cambill.prices.update(oldPrice.id, { active: false })You can still rename a price (nickname) and change its metadata. Sending a different unit_amount answers 400 Price Is Fixed.
Use a price on an invoice
lines: [{ price: once.id, quantity: 3 }] // amount and description come from the catalogueThe product's name becomes the line's description unless you give one. The price's currency must match the invoice's.
Archive a product
products.update(id, { name, active: false }). Archived products and prices cannot be added to new invoices or subscriptions.
In the dashboard
The product form takes prices too, and creates them with the product. Edit on a product's page changes its name, description and external ID.
Features are separate
Products, coupons, subscriptions and finance reports are each switched on for a business on their own. Turning on products does not turn on coupons or subscriptions; ask CamBill to enable the ones you need. Subscriptions also need invoicing, customers and products.