startOnlinePurchase( )


Orders and purchases a pricing plan.

startOnlinePurchase() 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 a site, a site first must be set up to offer pricing plans as described in Pricing Plans: An Overview. When setting up a 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, a site needs to be published publish.
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?