startOnlinePurchase( )


Orders and purchases a pricing plan.

The startOnlinePurchase() function returns a Promise that resolves to a Purchase object when the member completes the purchase process. Depending on whether the plan is free, the Purchase object returns different properties.

To process pricing plans on your site, first set up your site to offer pricing plans as described in About Pricing Plans. When setting up your site to accept pricing plans, define the plans you want to offer, including the payment method.

Purchasing a plan orders the plan and continues the payment process with the Wix Pay API. After payment is complete, the plan is assigned to the member.

To understand the lifecycle of how startOnlinePurchase() is used, see Direct Purchase of a Pricing Plan.

Notes:

  • The pricing plan startOnlinePurchase() function replaces the deprecated paid plans purchasePlan() function. The deprecated function will continue to work, but will not receive updates. To keep any existing code compatible with future changes, see the purchasePlan() migration instructions.

  • To work with the Pricing Plans API, you need to publish your site.

Method Declaration
Copy
Method Parameters
planIdstringRequired

The plan ID.


startDate

Start date and time for the ordered plan.

Returns
Return Type:Promise<Purchase>
Was this helpful?
Yes
No