Models

Customer Model

A customer is a user who is being billed for a subscription. This model includes information about the customer, such as their name, email, address, etc.

Properties

idstring
required

The unique identifier of the customer

namestring
recommended

Name of the customer. If your app has lastName, this should be set to firstName value.

lastNamestring
optional

Set this if your app has lastName and firstName, otherwise use name.

emailstring
recommended

It's recommended to specify either email or phone, or both. If none is specified, some features won't be available.

phonestring
recommended

It's recommended to specify either email or phone, or both. If none is specified, some features won't be available.

addressesarray
recommended

Array of customer's billing addresses. First address is considered primary

discountsarray
optional

Array of discounts applied to the customer. If your app has customer level discounts, you can specify them in the discounts array. Make sure you already have a Coupon model to use it here.

currencystring
optional

If your app associates a currency with a customer, set this field to an ISO currency code ISO 4217.

metadataobject
optional

Arbitrary data in key-value format. Where both key and value are strings.

Code Example

import { Integrator } from '@churnkey/sdk'
export class Customer extends Integrator.Customer {
    constructor(customer: YourCustomer) {
        super({
            id: customer.id,
            ... // map other properties
        })
    }
}