When a new customer is provisioned in your application (for example, during registration or onboarding), you should also provision them in Stigg.You provide the customer’s unique identifier, and optionally their name, billing email address, a coupon to apply, initial subscription parameters, billing and shipping addresses (including tax IDs and payment method), and arbitrary metadata.
To control the customer’s initial access to a product according to the product’s Customer Journey settings, initial subscription parameters must be provided. To provision a customer without any default subscription, explicitly pass no subscription parameters.
Passing billing information will cause the customer to be synced to the integrated billing solution even if they don’t have any paid subscriptions. Billing information is not persisted on Stigg’s servers.
const customer = await stiggClient.provisionCustomer({ customerId: 'customer-test-id', name: 'My very first customer', // optional email: 'john@example.com', // optional - billing email address couponId: 'coupon-test-id', // optional subscriptionParams: { // optional - pass null to skip initial subscription planId: 'plan-basic', resourceId: 'resource-01', // optional, required for multiple subscription for same product billableFeatures: [{ // optional, required for subscriptions with per unit pricing featureId:'feature-01-templates', quantity: 2 }], billingPeriod: 'MONTHLY', // optional, relevant only for paid subscriptions addons: [{ // optional addonId: 'addon-extra-stuff', quantity: 1, }], promotionCode: 'STIGG30', // optional billingCountryCode:'DK', // optional, required for price localization, must be in the ISO-3166-1 format metadata: { // optional key: 'value', }, }, metadata: { // optional - metadata that will be stored in Stigg key: "value", }});
Customer information can be updated at any time. Only the fields being updated need to be sent.
Since billing information is not persisted on Stigg’s servers, the entire billing information object must be passed each time it needs to be updated.
const customer = await stiggClient.updateCustomer({ customerId: 'customer-test-id', email: 'john@example.com', // optional, use to update the customer's email address couponId: 'coupon-test-id', // optional, use to apply a coupon to a customer billingInfo: { // optional, use to update the customer's billing information ... }, metadata: { // optional, use to update the customer's metadata key: 'value', }});
They will no longer be returned by the Stigg API and SDKs.
New customers cannot reuse the customer ID of archived customers. When Stigg is integrated with a billing solution, archived customers will still exist in the billing solution to allow upcoming invoices to be finalized.