Developer tools
Using subscriptions

Using Subscriptions

Learn how to configure the Stripe Magento 2 module to enable subscriptions for any Magento product.

How to enable and configure subscriptions

You can enable subscriptions for any Magento product from the product configuration page. When creating or editing a product, scroll down until you see the Stripe Subscriptions section:

Configuration options for subscriptions

Here, you have the following options:

  • Subscription Enabled: Turn this on to convert this product into a subscription.
  • Frequency: Select Days, Weeks, Months, or Years. The customer front end displays whatever you select here for the frequency. If you prefer to display 30 Days instead of 1 Month, set this to Days instead. If you select Days, the subscription is also created in days in your Stripe account.
  • Repeat Every: This number determines the length of the billing cycle for a subscription using the frequency defined above. For example, if you selected Days for the Frequency setting, billing occurs every 30 days.
  • Trial Days: Enter the number of days before the first charge for the subscription (i.e., the number of free days).
  • Initial Fee: Enter an amount to be billed in addition to the subscription price.

You don’t need to do create a subscription plan in your Stripe account. A subscription plan is automatically created for this product when your customers check out.

Additional configuration

You can configure additional settings in the Payment Methods section of the Magento Admin Panel.

Payment method configuration options for subscriptions

Shipping Cost: You can configure the shipping cost to create only one charge (when the customer places the order), or on a recurring basis. When charged on a recurring basis, it’s added to the subscription invoice for every billing period, as shown below:

Summary view of a subscription invoice

Viewing or canceling subscriptions

When customers navigate to their account, they can view their purchased subscriptions by clicking the My Subscriptions link on the sidebar:

Viewing active subscriptions

Customers can view or cancel their subscriptions and edit their shipping address from here. When they edit their shipping address, it’s not changed on the original order, only the metadata is updated on the actual subscription.

Creating recurring subscription orders using Stripe webhooks

When you create a monthly subscription for a customer, Stripe issues an invoice every month, which is automatically paid in your Stripe account. If you have configured webhooks, Magento can receive notifications from Stripe that an invoice has been created, and will automatically create a new order for that subscription product in your Magento Admin Panel. If the customer originally placed the order with multiple subscriptions and products in the same cart, then recurring orders will be generated separately for each subscription in the original order. Initial subscription fees will be dropped from the recurring orders, and shipping/tax details will be recalculated for the individual recurring subscription product.

Creating a configurable subscription

You can find two examples of configurable subscriptions on the demo server. The two products were created in Magento as Configurable Products and have both Customizable Options and configurations under each of their product pages.

Use Customizable Options when you need to offer different prices for the same product. For example, for the Coffee Beans example, you can select a custom bag size which increases the subscription price if a larger bag is selected.

Use Configurations when you need to offer subscriptions of different frequencies to the customer. The Dropdown and Text Swatch controls allow the customer to select between One-off, Monthly, or Quarterly subscriptions.

You can review how these products have been configured in the Magento Admin Panel:

In the example above, each Simple Product, created automatically by Magento, also has a subscription enabled and configured. Each product is grouped together through Configurations, which you create manually.

To create a configurable product:

  1. Create a new product from the Catalog (it can be simple or virtual product).
  2. Scroll down and find the Configurations tab.

Creating a new product with a configuration

  1. Click Create Configurations.

Creating a product configuration

  1. Create a new attribute called subscription and make sure it’s set to Global under the Advanced Attribute Properties tab (example). You can also use Advanced Attribute Properties to determine whether you want this attribute to be a Dropdown or a Text Swatch (example).
  1. Under Manage Options, add the values that will appear in the dropdown or text swatch. For text swatches, you must also complete the Swatch column.

Manage the swatch options

  1. Under the Manage Labels tab, add whatever you want the customer to see on the product page. (e.g., “Subscribe and save 5%”).
  1. If you’re configuring the attribute as a Text Swatch, you can enable Used in product listing under Advanced Attribute Properties so that it appears in the catalog in a similar manner as the demo server.
  1. Save the attribute. It’s now in the attributes list where you can select it and click Next.
  1. Select all of the attribute values on the next page and complete the steps until you are back on the product page.

Current Configurations

  1. Magento then creates the simple products for you based on the attribute options. You can set the prices and product images at this step from the Configurations tab.
  1. Navigate back to the products catalog and select each of the newly created subscription products.
  1. Make sure that the Subscription attribute of each product has the correct value:

Configure the Subscription attribute

  1. Enable and configure each product’s subscription from the Stripe Subscriptions tab.

The Stripe Subscriptions options

Next steps

Learn more about how to install and configure the module:

Was this page helpful?
Questions? Contact us.
Developer tutorials on YouTube.
You can unsubscribe at any time. Read our privacy policy.