Introduction

Use the Custom Purchase Flow API to customize the pages in the plan purchase flow on a site. This API provides functionality for directing users to the Plans & Pricing and Checkout pages outside of the default flow. It also allows you to customize the content displayed on the Plan & Pricing, Checkout, and Thank You pages.

Set up pricing plans

To use APIs to customize the plan purchase flow, a site must first be set up to:

Direct users to pages in the purchase flow

The Custom Purchase Flow API lets you direct customers to either of 2 pages in the plan purchase flow:

  • The Plans & Pricing page: You can navigate from anywhere in a site to the Plans & Pricing page.
  • The Checkout page: If a site uses a custom Plans & Pricing page, you can navigate to checkout from anywhere in a site, including the Plans & Pricing page. If a site uses the default Plans & Pricing page, visitors will still be directed from Plans & Pricing to the Checkout page without you calling any method. However, you may also direct customers to checkout from any other page in a site.

Customize the content of the Plans & Pricing and Checkout pages

You can use navigateToPricingPage() and navigateToCheckout() methods to customize pages in the plan purchase flow:

  • Customizing the Plans & Pricing page: You can set page content such as the title and subtitle of the Plans & Pricing page by passing options to navigateToPricingPage(). In the same method you can also pass options to customize the content on the Checkout and Thank You pages.
  • Customizing the Checkout page: In navigateToCheckout(), you can pass options to customize the content displayed on the Checkout and Thank You pages.
  • Retrieving the Pricing Page options: You can call getPricingPageOptions() on the Plans & Pricing page to retrieve the Pricing page options you set in navigateToPricingPage().

Customize the pricing plan purchase flow

You can now add custom pages to the pricing plan flow, as well as build a custom Plans & Pricing page.

If you add pages between Plans & Pricing and Checkout, you'll need to store the options set in navigateToPricingPage() globally, for example using the Wix Storage API and access them before you call navigateToCheckout().

If you are navigating directly from the Plans & Pricing page to Checkout, you can call getPricingPageOptions() and pass the retrieved options directly to navigateToCheckout().

Import the APIs

To use the CustomPurchaseFlow API, import customPurchaseFlow from the wix-pricing-plans-frontend module.

Copy
Did this help?