Introduction

Use the Pricing Plans API to create and manage your pricing plans.

You can build a customized membership plan experience based on the plans that you create and manage with the Pricing Plan APIs.

Set up pricing plans

To use Pricing Plans APIs to manage your plans, first set up your site to:

Manage pricing plans

You can use the Pricing Plans API to create and manage plans. You can:

  • Create and update pricing plans.
  • List and query pricing plans.
  • Set which plans are public and which plans are hidden.
  • Archive plans.
  • Set or clear the primary plan. This determines if a plan is highlighted with a custom ribbon when viewing the plans on the site.
  • Get statistics about the plans.
  • Rearrange the order of how plans display.

Ordering pricing plans

With the Pricing Plan APIs you can customize the purchase flow. For example, you may add your own lightboxes and forms.

When creating or updating a plan, you can set if a plan can be ordered by a given site member only once or multiple times using the maxPurchasesPerBuyer property.

Updating the properties of a pricing plan does not affect any current orders of the plan by site members. The existing orders retain their existing terms and pricing.

Members can purchase pricing plans in 2 ways:

  • Online. Members order and pay for their plans on your site without manual intervention.
  • Offline. Members place their order by phone, text, or email. You manually record each stage of the transaction.

You can use the Pricing Plans APIs to manage the purchase of both online and offline orders.

A typical online ordering flow

  1. Use the Pricing Plans createPlan() function to create the plans you want to offer on your site.
  2. A site visitor chooses a plan for purchase.
  3. Use the Checkout previewPrice() function to show the site visitor a preview of how much the plan will cost, including or excluding taxes, as defined on your site.
  4. If the site visitor confirms, ask the visitor to log in.
  5. Use the Checkout previewOnlineOrder() function to get final confirmation.
  6. After receiving confirmation, call the createOnlineOrder() function to start a draft of the order. createOnlineOrder() returns a wixPayOrderId.
  7. Direct the order to Wix Pay's startPayment() function, sending the wixPayOrderId as an input parameter.
  8. After payment is made, the functionality available with the Orders APIs is available for managing the orders.

A typical offline ordering flow

  1. Use the Pricing Plans createPlan() function to create the plans you want to offer on your site.
  2. A site visitor contacts you offline to make a purchase.
  3. Use the Checkout previewPrice() and the previewOfflineOrder() functions to send the buyer the order details for confirmation.
  4. Call the createOfflineOrder() function to start a draft of the order.
  5. Receive payment.
  6. After payment is made, call the Orders markAsPaid() function.
  7. The functionality available with the Orders APIs is available for managing the orders.

Roles and permissions

You need "Manage Pricing Plans" permissions to perform management functions, such as createPlan(), update-plan(), archivePlan(), and so on.

The following roles are predefined with "Manage Pricing Plans" permissions when the Pricing Plan app is added to the site:

You do not need "Manage Pricing Plans" permissions to use the listPublicPlans() and queryPublicPlans() functions.

Pricing models

Pricing models contain the pricing and duration options for a plan.

Plans are based on a pricing model, which is defined with the plan's pricing property. A pricing model can be one of the following:

  • A subscription: A plan with recurring payment cycles.

    Example: A 1-year subscription with monthly, recurring payments. Each payment is $25, so the total price for the plan is $300. In this example, the subscription is in its third month.

    cycleDuration is the length of one payment cycle. Multiply cycleDuration's count by cycleCount to get the subscription duration. Currently, cycleDuration only supports a value of 1.

    index of currentCycle is the current payment cycle for the subscription. index is 0 when the order is in a free trial period. In all other cases, the index starts with 1 for the first payment cycle in the subscription. For orders with a single payment, the index will remain 1 throughout the duration.

    Copy
  • A plan that does not renew: A plan paid for with a single payment. The plan does not renew after the duration.

    Example: A plan with a single payment of $35 for 3 months.

    The duration cycleFrom and numberOfCycles will both be 1, as the single price applies to the entirety of the subscription.

    index of currentCycle will remain 1 throughout the duration.

    Copy
  • An unlimited plan: A plan paid for with a single payment. The plan does not expire and remains valid until canceled.

    Example: An unlimited plan that is paid for in advance with one payment of $200.

    singlePaymentUnlimited is true.

    The duration cycleFrom and numberOfCycles will remain 1 throughout the duration of the plan.

    index of currentCycle will remain 1 throughout the duration. singlePaymentUnlimitedPlans don't return an endedDate in currentCycle.

    Copy

Free plans and free trial periods

A free plan that is valid until canceled is a singlePaymentUnlimited pricing model. A free plan with a limited duration is treated as a singlePaymentForDuration pricing model.

A site owner can also add a free trial period, in days, to a subscription pricing model. When the free trial is over, the first payment cycle begins and the buyer is billed. During the free trial period, the index of currentCycle is 0. A buyer only receives the free trial period for the first time they purchase a plan. For example, a buyer purchases a monthly plan for 3 months that includes a 7-day free trial period. The buyer may purchase the same plan again, for another 3 months, but will not receive the 7-day free trial period.

When a buyer cancels their order during the free trial period, their subscription will expire at the end of the free trial period and they will not be billed. A site owner can cancel an ordered plan during the free trial period and choose to apply the cancellation IMMEDIATELY or at the NEXT_PAYMENT_DATE. Canceling IMMEDIATELY ends the subscription for the buyer immediately, even during the free trial period, and the buyer won't be billed. Canceling at the NEXT_PAYMENT_DATE allows the buyer to continue using the benefits of the subscription until the end of the free trial period. Then, the subscription ends and the buyer is not billed.

Pricing plan types and visibility

  • Public pricing plans are visible plans that site members and visitors can see on the site and purchase. By default, pricing plans are public when created.

  • Hidden pricing plans are plans whose public property has been set to false. These plans cannot be seen on the site by the site member or visitor. For example, consider hiding a plan if it has reached its maximum capacity and temporarily is not available for purchase.

    Changing a plan’s visibility with the public property does not impact existing purchases. All purchases for hidden plans are still active and keep their terms and payment options.

  • Active pricing plans include all non-archived plans, such as public plans and hidden plans.

  • Archived pricing plans are plans that are no longer needed on the site. For example, discontinued plans. When a plan is archived, it is no longer visible as a public plan that can be chosen by site visitors. The public property is automatically set to false when a plan is archived. Archived plans cannot be purchased.

    Site owners can see archived plans in the Dashboard under Pricing Plans -> Archived Plans.

    Archiving cannot be reversed. Once archived, a plan cannot be set as active again for purchase. Archiving does not impact existing purchases made for the plan. All purchases are still active and keep their pricing and terms.

Importing pricing plans

To use the Pricing Plans API, import wixPricingPlansBackend from the wix-pricing-plans-backend module.

Copy
Did this help?