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.

Note:

  • To work with the Pricing Plans API, you need to publish your site.
Method Declaration
Copy
Method Parameters
planIdstringRequired

The plan ID.


startDateDate

Start date and time for the ordered plan.

Returns
Return Type:Promise<Purchase>
Did this help?