1. Creating a Subscription

To turn a product into a subscription, you just need to add the recurring field to the product configuration.

Subscription Example
const config = {
  // ...
  products: [
    {
      // ...
      id: 'subscription_id',
      name: 'Test Subscription',
      price: {
        initial: 9.99,
        minimum: 7.99,
      },
      recurring: {
        unit: 'MONTH',
        count: 1,
      },
    },
  ],
};

In this example, the subscription is charged monthly.

2. Adding a trial period

You can add a trial period to your subscription to give your customers a chance to try out the product before committing to a long-term subscription.

Subscription Example
const config = {
  // ...
  products: [
    {
      // ...
      id: 'subscription_id',
      name: 'Test Subscription',
      price: {
        initial: 9.99,
        minimum: 7.99,
      },
      recurring: {
        unit: 'MONTH',
        count: 1,
      },
      trial: {
        unit: 'MONTH',
        count: 3,
      },
    },
  ],
};

In this example, the subscription has a trial period of 3 months.