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 planspurchasePlan()
function. The deprecated function will continue to work, but will not receive updates. To keep any existing code compatible with future changes, see thepurchasePlan()
migration instructions. -
To work with the Pricing Plans API, you need to publish your site.
The plan ID.
Start date and time for the ordered plan.