Products
List the products, and load a product, a variant, or a plan.
A shop sells two kinds of product. A one-time product holds variants; a
subscription product holds plans. A parent product is what you list and show
on a page; a variant or a plan is what a customer buys, and its id is the
productId you send to subbly.cart.addItem.
Every method here takes an optional headers argument to price one response in
another currency; see Currency.
Gets a page of the shop's parent products.
Method parameters
paramsoptionalProductsListParamsWhich products to return.
headersoptionalProductRequestHeadersExtra request headers, such as x-currency.
ReturnsPromise<ProductsListResponse>
One page of products.
List the products
List the subscription products only
Loads one parent product, with its variants or its plans.
Method parameters
productIdRequirednumberID of the parent product.
paramsoptionalProductsResourceParamsExtra data to include.
headersoptionalProductRequestHeadersExtra request headers, such as x-currency.
ReturnsPromise<ParentProduct>
The product. Narrow on type to read variants or plans.
Load a product
Loads one product variant, the buyable child of a one-time product.
Pass a variant ID, not the ID of its parent. The endpoint behind this method
also serves plans, so the declared result is a variant or a plan; use
subbly.products.loadPlan when you hold a plan ID.
Method parameters
productIdRequirednumberID of the variant.
paramsoptionalProductsResourceParamsExtra data to include.
headersoptionalProductRequestHeadersExtra request headers, such as x-currency.
ReturnsPromise<Product>
The variant, or the plan when the ID belongs to one.
Load a variant
Loads one subscription plan, the buyable child of a subscription product. Older material calls a plan a pricing.
loadPlan and loadVariant call the same endpoint; only the type of the result
differs. Use loadPlan when the ID belongs to a plan.
Method parameters
productIdRequirednumberID of the plan.
paramsoptionalProductsResourceParamsExtra data to include.
headersoptionalProductRequestHeadersExtra request headers, such as x-currency.
ReturnsPromise<ProductPlan>
The plan.
Load a plan