Product Model
If you are implementing a Product
model, make sure you pass productId
to the Price
model. This way, you can associate a price with a product.
Type
Depending on your app's architecture, products can belong to a Family or be standalone entities. In both cases, you can start by implementing a standalone Product model, and later refactor it to add families support.
If you implement a family-based product, you will need to create a Families controller and set the familyId
property on the product.
Properties
Unique identifier of the product
'standalone'
'family'
Type of the product. All products should have a same type.
Customer-facing name.
Customer-facing description.
Label for the unit of the product. For example, 'GB' for data plans.
ID of the family this product belongs to. type
should be set to 'family'
Code Example
import { Integrator } from '@churnkey/sdk'
// export class Product extends Integrator.Product.Family {
export class Product extends Integrator.Product.Standalone {
constructor(product: YourProduct) {
super({
id: product.id,
... // map other properties
})
}
}