> Portal Navigation:
>
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt
# GetOfflineOrderPreview
# Package: pricingPlans
# Namespace: CheckoutService
# Method link: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/orders/get-offline-order-preview.md
## Permission Scopes:
Manage Orders: SCOPE.DC-PAIDPLANS.MANAGE-ORDERS
## Introduction
Performs a dry run of a purchase and provides an order preview.
The preview uses the same logic as purchasing a plan, but the preview is not saved. Because an order is not actually
created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters
(`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview.
But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then
`purchaseLimitExceeded` will return as `true`.
To get a general price preview for a plan that's not buyer-specific, call Get Price Preview.
---
## REST API
### Schema
```
Method: getOfflineOrderPreview
Description: Performs a dry run of a purchase and provides an order preview. The preview uses the same logic as purchasing a plan, but the preview is not saved. Because an order is not actually created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters (`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview. But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then `purchaseLimitExceeded` will return as `true`. To get a general price preview for a plan that's not buyer-specific, call Get Price Preview.
URL: https://www.wixapis.com/pricing-plans/v2/checkout/orders/preview-offline
Method: POST
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: planId, memberId
Method parameters:
param name: couponCode | type: couponCode | description: Coupon code to apply, from the Coupons API.
param name: memberId | type: memberId | description: Member GUID of the buyer the previewed order is for, from the Members API. | required: true
param name: planId | type: planId | description: GUID of the plan of the previewed order, from the Plans API. | required: true
param name: startDate | type: startDate | description: Start date and time for plan of the previewed order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format. Default: Current date and time.
Return type: GetOfflineOrderPreviewResponse
- name: order | type: Order | description: The previewed order, as if the plan had been ordered.
- name: id | type: string | description: Order GUID.
- name: planId | type: string | description: GUID of the plan purchased with the order, from the Plans API.
- name: subscriptionId | type: string | description: GUID of the related Wix subscription. Every pricing plan order corresponds to a Wix subscription, including orders for single payment plans. Learn more in a [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business).
- name: wixPayOrderId | type: string | description: Wix Pay order GUID. Provided by Wix whether the order is created online or offline. The field is omitted when the order is free.
- name: buyer | type: Buyer | description: The buyer's GUIDs. Includes `memberId` and `contactId`. Currently, Pricing Plan purchases are limited to members only. `contactId` is returned, but a buyer will not be able to purchase a plan without a `memberId`.
- name: memberId | type: string | description: Member GUID for a Wix site member, from the Members API.
- name: contactId | type: string | description: Contact GUID for a Wix site contact, from the Contacts API.
- name: pricing | type: PricingDetails | description: Order pricing model, price, and payment schedule. Learn more about [pricing models](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models).
- ONE-OF:
- name: subscription | type: Recurrence | description: Pricing model for an order with recurring payment cycles.
- name: cycleDuration | type: Duration | description: Number of payment cycles the subscription is valid for. `0` for unlimited plans or for plans that are valid until canceled.
- name: count | type: integer | description: Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`.
- name: unit | type: PeriodUnit | description: Unit of time for the cycle duration.
- enum:
- UNDEFINED: Not defined.
- DAY: Time unit is a day.
- WEEK: Time unit is a week.
- MONTH: Time unit is a month.
- YEAR: Time unit is a year.
- name: cycleCount | type: integer | description: Length of a payment cycle. For example, 1 month to have monthly payments. Multiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration. Currently, only a value of `1` is supported.
- name: singlePaymentForDuration | type: Duration | description: Pricing model for an order with a one-time payment and the order is valid for a specific amount of time.
- name: singlePaymentUnlimited | type: boolean | description: Pricing model for an order with a one-time payment and the order is valid until canceled.
- name: prices | type: array | description: Pricing details for all pricing models.
- name: duration | type: PriceDuration | description: Cycle duration to apply `price` for. Use with all pricing models. Can apply the same price to multiple payment cycles.
- name: cycleFrom | type: integer | description: Price starts to apply with this cycle. `1` is the first payment cycle for all pricing models.
- name: numberOfCycles | type: integer | description: Amount of cycles to apply price for. For `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`. For `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned. For `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`.
- name: price | type: Price | description: Order price.
- name: subtotal | type: string | description: Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.
- name: coupon | type: Coupon | description: Coupon applied to the order, from the Coupons API.
- name: code | type: string | description: Code of the applied coupon.
- name: amount | type: string | description: Total discount of the coupon, as a monetary amount.
- name: id | type: string | description: Coupon GUID.
- name: discount | type: string | description: Total discount applied to the order.
- name: tax | type: Tax | description: Tax applied to the order. Tax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
- name: name | type: string | description: Name of the tax. For example, VAT.
- name: includedInPrice | type: boolean | description: Whether tax is included in the original price. When `false`, tax is added at checkout.
- name: rate | type: string | description: Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.
- name: amount | type: string | description: Total tax, specified as a monetary amount. For example, `"3.99"`.
- name: total | type: string | description: Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`. If no tax is applied, the amount is the same as `subtotal`.
- name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
- name: proration | type: string | description: Price change after billing date was change and price was adjusted. Could be positive and negative values.
- name: type | type: OrderType | description: How the order was processed.
- enum:
- UNDEFINED: Undefined order type.
- ONLINE: The buyer purchased the plan using the site.
- OFFLINE: The buyer made a manual, offline purchase without using the site.
- EXTERNAL: The buyer made a purchase through an external payment provider.
- name: status | type: OrderStatus | description: Status of the order.
- enum:
- UNDEFINED: Undefined order status.
- DRAFT: Order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use to the buyer.
- PENDING: Order has been purchased and its start date is set in the future.
- ACTIVE: Order has been processed. The plan is available for use.
- PAUSED: Order, and use of the plan, is paused. The order, and use of the plan, can be resumed.
- ENDED: Order has completed its duration and is no longer available for use.
- CANCELED: Order has been canceled.
- name: autoRenewCanceled | type: boolean | description: Whether the order will be canceled at the next payment date. If `true`, the order status will be `CANCELED` and the next payment won't be charged. Omitted for single payment orders.
- name: cancellation | type: Cancellation | description: Details about the cancellation of an order. Only present if the status is `CANCELED`.
- name: requestedDate | type: string | description: Date and time the cancellation was requested.
- name: cause | type: CancellationCause | description: Reason for the cancellation.
- enum:
- UNDEFINED: Undefined cancellation cause.
- OWNER_ACTION: Wix user canceled the order.
- MEMBER_ACTION: Buyer initiated the cancellation.
- PAYMENT_FAILURE: Payment transaction failed.
- PAYMENT_SETUP_FAILURE: Buyer's payment details weren't set up correctly.
- UNKNOWN: Reason for the cancellation is unknown.
- name: effectiveAt | type: CancellationEffectiveAt | description: When the cancellation takes effect. Set when cancelling the order.
- enum:
- UNDEFINED: Undefined cancellation time.
- IMMEDIATELY: Cancellation occurs immediately and the buyer can no longer use the plan.
- NEXT_PAYMENT_DATE: Cancellation occurs at the next payment date and time. Buyer can continue to use the plan until that date and time.
- name: lastPaymentStatus | type: PaymentStatus | description: Status of the last payment for the order. Updated automatically for online orders. Updated manually by the Wix user for offline orders.
- enum:
- UNDEFINED: Undefined payment status.
- PAID: Payment has been paid.
- REFUNDED: Payment has been refunded.
- FAILED: Payment transaction didn't complete.
- UNPAID: Payment has not been paid.
- PENDING: Billing has been initialized, but actual charge is yet to be made. This can happen for free trials and payments made with PayPal.
- NOT_APPLICABLE: No payment was necessary. For example, for free plans or free trials.
- name: startDate | type: string | description: Start date and time for the ordered plan.
- name: endDate | type: string | description: Current end date and time for the ordered plan. `endDate` may be updated over the course of an order. If the order is paused, it will have a later `endDate` once it is resumed. `endDate` may also be postponed. Omitted if the order is valid until canceled and still `ACTIVE`.
- name: pausePeriods | type: array | description: List of periods during which the order is paused.
- name: status | type: Status | description: Status of the pause period.
- enum:
- UNDEFINED: Undefined status.
- ACTIVE: Status while the order is paused.
- ENDED: Status when the order is resumed.
- name: pauseDate | type: string | description: Start date and time of the pause period.
- name: resumeDate | type: string | description: End date and time of the pause period. Omitted while the pause period remains `ACTIVE`.
- name: freeTrialDays | type: integer | description: Free trial period for the order, in days. Only available for recurring plans.
- name: earliestEndDate | type: string | description: Earliest end date and time that the plan for the order can expire. Calculated by using the original end date plus any pause periods. Omitted if the order is active until canceled. Reserved for future use.
- name: currentCycle | type: CurrentCycle | description: Current payment cycle for the order. `currentCycle` will be omitted if the order's status is `CANCELED` or `ENDED`, or if the `startDate` hasn't passed yet.
- name: index | type: integer | description: Index of the current payment cycle in the order. `0` when order is in a free trial period. In all other cases, the index starts with `1`.
- name: startedDate | type: string | description: Start date and time for the current payment cycle.
- name: endedDate | type: string | description: End date and time for the current payment cycle.
- name: planName | type: string | description: Plan name at the time of purchase.
- name: planDescription | type: string | description: Plan description at the time of purchase
- name: planPrice | type: string | description: Plan price as it was at the moment of order creation.
- name: createdDate | type: string | description: Date and time the order was created.
- name: updatedDate | type: string | description: Date and time the order was updated.
- name: formData | type: FormData | description: Information about the form submitted during the plan's checkout.
- name: formId | type: string | description: GUID of the [order form](https://dev.wix.com/docs/rest/api-reference/wix-forms/form-submissions/introduction.md) associated with the plan at checkout.
- name: submissionId | type: string | description: GUID of a submission to the plan's order form at checkout. Every time a visitor completes the checkout process for a plan, a new submission is created.
- name: submissionData | type: Map | description: Data submitted to the plan's order form at checkout.
- ONE-OF:
- name: nullValue | type: | description:
- name: numberValue | type: number | description:
- name: stringValue | type: string | description:
- name: boolValue | type: boolean | description:
- name: structValue | type: object | description:
- name: listValue | type: ListValue | description:
- name: values | type: array | description:
- name: purchaseLimitExceeded | type: boolean | description: Whether this previewed order would exceed the permitted amount of purchases available for this plan for this buyer. Always `false` for plans that do not have purchase limits.
Possible Errors:
HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: invalid_sort_field | Description: Invalid sort field specified.
HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: undefined_not_allowed | Description: Undefined values aren't allowed.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: MISSING_BUSINESS_ADDRESS_STATE | Description: Business address state is missing.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: MISSING_BUSINESS_ADDRESS_COUNTRY | Description: Business address country is missing.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_INVALID_SUBTOTAL | Description: Subtotal is invalid for the applied coupon.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_NOT_APPLICABLE_FOR_PLAN | Description: Coupon can't be applied to this plan.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_DOES_NOT_EXIST | Description: Coupon doesn't exist.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_HAS_EXPIRED | Description: Coupon has expired.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_IS_NOT_ACTIVE_YET | Description: Coupon isn't active yet.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_LIMIT_PER_CUSTOMER_EXCEEDED | Description: Coupon limit per customer exceeded.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_USAGE_EXCEEDED | Description: Coupon usage limit exceeded.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_IS_DISABLED | Description: Coupon is disabled and can't be applied.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PRICING_PLANS_NOT_INSTALLED | Description: Pricing Plans app isn't installed on the site.
```
### Examples
### GetOfflineOrderPreview
```curl
~~~cURL
curl -X POST \
'https://www.wixapis.com/pricing-plans/v2/checkout/orders/preview-offline' \
-H 'Authorization: ' \
-H 'Content-Type: application/json' \
--data-raw '{
"planId": "5779edd3-2994-4bf4-acfe-d739ad2d95bd",
"memberId": "805ce40a-9000-464e-85ed-5bb052d8beb7",
"startDate": "2022-07-08T00:00:00Z"
}'
~~~
```
---
## JavaScript SDK
### Schema
```
Method: wixClientAdmin.pricingPlans.CheckoutService.getOfflineOrderPreview(planId, memberId, options)
Description: Performs a dry run of a purchase and provides an order preview. The preview uses the same logic as purchasing a plan, but the preview is not saved. Because an order is not actually created, the preview order's `orderId` and `subscriptionId` are displayed as a string of multiple zero characters (`000000-0000`). Tax is only calculated if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
If a pricing plan has a limit on the amount of purchases per buyer, that limit is not considered for generating the preview. But, if that limit has been reached and this order would then exceed the amount of purchases permitted for this buyer, then `purchaseLimitExceeded` will return as `true`. To get a general price preview for a plan that's not buyer-specific, call Get Price Preview.
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: planId, memberId
Method parameters:
param name: memberId | type: string | description: Member GUID of the buyer the previewed order is for, from the Members API. | required: true
param name: options | type: GetOfflineOrderPreviewOptions none
- name: startDate | type: Date | description: Start date and time for plan of the previewed order in a `YYYY-MM-DDThh:mm[:ss][.sss]Z` format. Default: Current date and time.
- name: couponCode | type: string | description: Coupon code to apply, from the Coupons API.
param name: planId | type: string | description: GUID of the plan of the previewed order. | required: true
Return type: PROMISE
- name: order | type: Order | description: The previewed order, as if the plan had been ordered.
- name: _id | type: string | description: Order GUID.
- name: planId | type: string | description: GUID of the plan purchased with the order, from the Plans API.
- name: subscriptionId | type: string | description: GUID of the related Wix subscription. Every pricing plan order corresponds to a Wix subscription, including orders for single payment plans. Learn more in a [Pricing Plans overview](https://support.wix.com/en/article/pricing-plans-an-overview#create-plans-to-suit-your-business).
- name: wixPayOrderId | type: string | description: Wix Pay order GUID. Provided by Wix whether the order is created online or offline. The field is omitted when the order is free.
- name: buyer | type: Buyer | description: The buyer's GUIDs. Includes `memberId` and `contactId`. Currently, Pricing Plan purchases are limited to members only. `contactId` is returned, but a buyer will not be able to purchase a plan without a `memberId`.
- name: memberId | type: string | description: Member GUID for a Wix site member, from the Members API.
- name: contactId | type: string | description: Contact GUID for a Wix site contact, from the Contacts API.
- name: pricing | type: PricingDetails | description: Order pricing model, price, and payment schedule. Learn more about [pricing models](https://dev.wix.com/api/rest/wix-pricing-plans/pricing-plans/introduction#wix-pricing-plans_pricing-plans_introduction_pricing-models).
- ONE-OF:
- name: subscription | type: Recurrence | description: Pricing model for an order with recurring payment cycles.
- name: cycleDuration | type: Duration | description: Number of payment cycles the subscription is valid for. `0` for unlimited plans or for plans that are valid until canceled.
- name: count | type: integer | description: Number of days, months, weeks, or years in a single payment cycle. Currently limited to support only `1`.
- name: unit | type: PeriodUnit | description: Unit of time for the cycle duration.
- enum:
- UNDEFINED: Not defined.
- DAY: Time unit is a day.
- WEEK: Time unit is a week.
- MONTH: Time unit is a month.
- YEAR: Time unit is a year.
- name: cycleCount | type: integer | description: Length of a payment cycle. For example, 1 month to have monthly payments. Multiply `cycleDuration`'s `count` by `cycleCount` to get the subscription duration. Currently, only a value of `1` is supported.
- name: singlePaymentForDuration | type: Duration | description: Pricing model for an order with a one-time payment and the order is valid for a specific amount of time.
- name: singlePaymentUnlimited | type: boolean | description: Pricing model for an order with a one-time payment and the order is valid until canceled.
- name: prices | type: array | description: Pricing details for all pricing models.
- name: duration | type: PriceDuration | description: Cycle duration to apply `price` for. Use with all pricing models. Can apply the same price to multiple payment cycles.
- name: cycleFrom | type: integer | description: Price starts to apply with this cycle. `1` is the first payment cycle for all pricing models.
- name: numberOfCycles | type: integer | description: Amount of cycles to apply price for. For `subscription` pricing models with a finite number of cycles, the `numberOfCycles` is the same as `pricing.subscription.cycleCount`. For `subscription` pricing models that are unlimited or until-canceled, the `numberOfCycles` is not returned. For `singlePaymentForDuration` and `singlePaymentUnlimited` pricing models, the `numberOfCycles` is `1`.
- name: price | type: Price | description: Order price.
- name: subtotal | type: string | description: Price of the order excluding tax, specified as a monetary amount. For example, `"9.99"`.
- name: coupon | type: Coupon | description: Coupon applied to the order, from the Coupons API.
- name: code | type: string | description: Code of the applied coupon.
- name: amount | type: string | description: Total discount of the coupon, as a monetary amount.
- name: _id | type: string | description: Coupon GUID.
- name: discount | type: string | description: Total discount applied to the order.
- name: tax | type: Tax | description: Tax applied to the order. Tax is only applied if the site [has it configured](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection).
- name: name | type: string | description: Name of the tax. For example, VAT.
- name: includedInPrice | type: boolean | description: Whether tax is included in the original price. When `false`, tax is added at checkout.
- name: rate | type: string | description: Tax rate percentage, as a number between 0 and 100. For example, a 7% tax rate is `"7.00"`.
- name: amount | type: string | description: Total tax, specified as a monetary amount. For example, `"3.99"`.
- name: total | type: string | description: Price after tax and discount is applied. Specified as a monetary amount, for example, `"13.98"`. If no tax is applied, the amount is the same as `subtotal`.
- name: currency | type: string | description: Three-letter currency code in [ISO-4217 alphabetic](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format.
- name: proration | type: string | description: Price change after billing date was change and price was adjusted. Could be positive and negative values.
- name: type | type: OrderType | description: How the order was processed.
- enum:
- UNDEFINED: Undefined order type.
- ONLINE: The buyer purchased the plan using the site.
- OFFLINE: The buyer made a manual, offline purchase without using the site.
- EXTERNAL: The buyer made a purchase through an external payment provider.
- name: status | type: OrderStatus | description: Status of the order.
- enum:
- UNDEFINED: Undefined order status.
- DRAFT: Order has been initiated but payment hasn't been processed yet. The plan isn't yet available for use to the buyer.
- PENDING: Order has been purchased and its start date is set in the future.
- ACTIVE: Order has been processed. The plan is available for use.
- PAUSED: Order, and use of the plan, is paused. The order, and use of the plan, can be resumed.
- ENDED: Order has completed its duration and is no longer available for use.
- CANCELED: Order has been canceled.
- name: autoRenewCanceled | type: boolean | description: Whether the order will be canceled at the next payment date. If `true`, the order status will be `CANCELED` and the next payment won't be charged. Omitted for single payment orders.
- name: cancellation | type: Cancellation | description: Details about the cancellation of an order. Only present if the status is `CANCELED`.
- name: requestedDate | type: Date | description: Date and time the cancellation was requested.
- name: cause | type: CancellationCause | description: Reason for the cancellation.
- enum:
- UNDEFINED: Undefined cancellation cause.
- OWNER_ACTION: Wix user canceled the order.
- MEMBER_ACTION: Buyer initiated the cancellation.
- PAYMENT_FAILURE: Payment transaction failed.
- PAYMENT_SETUP_FAILURE: Buyer's payment details weren't set up correctly.
- UNKNOWN: Reason for the cancellation is unknown.
- name: effectiveAt | type: CancellationEffectiveAt | description: When the cancellation takes effect. Set when cancelling the order.
- enum:
- UNDEFINED: Undefined cancellation time.
- IMMEDIATELY: Cancellation occurs immediately and the buyer can no longer use the plan.
- NEXT_PAYMENT_DATE: Cancellation occurs at the next payment date and time. Buyer can continue to use the plan until that date and time.
- name: lastPaymentStatus | type: PaymentStatus | description: Status of the last payment for the order. Updated automatically for online orders. Updated manually by the Wix user for offline orders.
- enum:
- UNDEFINED: Undefined payment status.
- PAID: Payment has been paid.
- REFUNDED: Payment has been refunded.
- FAILED: Payment transaction didn't complete.
- UNPAID: Payment has not been paid.
- PENDING: Billing has been initialized, but actual charge is yet to be made. This can happen for free trials and payments made with PayPal.
- NOT_APPLICABLE: No payment was necessary. For example, for free plans or free trials.
- name: startDate | type: Date | description: Start date and time for the ordered plan.
- name: endDate | type: Date | description: Current end date and time for the ordered plan. `endDate` may be updated over the course of an order. If the order is paused, it will have a later `endDate` once it is resumed. `endDate` may also be postponed. Omitted if the order is valid until canceled and still `ACTIVE`.
- name: pausePeriods | type: array | description: List of periods during which the order is paused.
- name: status | type: Status | description: Status of the pause period.
- enum:
- UNDEFINED: Undefined status.
- ACTIVE: Status while the order is paused.
- ENDED: Status when the order is resumed.
- name: pauseDate | type: Date | description: Start date and time of the pause period.
- name: resumeDate | type: Date | description: End date and time of the pause period. Omitted while the pause period remains `ACTIVE`.
- name: freeTrialDays | type: integer | description: Free trial period for the order, in days. Only available for recurring plans.
- name: earliestEndDate | type: Date | description: Earliest end date and time that the plan for the order can expire. Calculated by using the original end date plus any pause periods. Omitted if the order is active until canceled. Reserved for future use.
- name: currentCycle | type: CurrentCycle | description: Current payment cycle for the order. `currentCycle` will be omitted if the order's status is `CANCELED` or `ENDED`, or if the `startDate` hasn't passed yet.
- name: index | type: integer | description: Index of the current payment cycle in the order. `0` when order is in a free trial period. In all other cases, the index starts with `1`.
- name: startedDate | type: Date | description: Start date and time for the current payment cycle.
- name: endedDate | type: Date | description: End date and time for the current payment cycle.
- name: planName | type: string | description: Plan name at the time of purchase.
- name: planDescription | type: string | description: Plan description at the time of purchase
- name: planPrice | type: string | description: Plan price as it was at the moment of order creation.
- name: _createdDate | type: Date | description: Date and time the order was created.
- name: _updatedDate | type: Date | description: Date and time the order was updated.
- name: formData | type: FormData | description: Information about the form submitted during the plan's checkout.
- name: formId | type: string | description: GUID of the [order form](https://dev.wix.com/docs/rest/api-reference/wix-forms/form-submissions/introduction.md) associated with the plan at checkout.
- name: submissionId | type: string | description: GUID of a submission to the plan's order form at checkout. Every time a visitor completes the checkout process for a plan, a new submission is created.
- name: submissionData | type: Map | description: Data submitted to the plan's order form at checkout.
- ONE-OF:
- name: nullValue | type: | description:
- name: numberValue | type: number | description:
- name: stringValue | type: string | description:
- name: boolValue | type: boolean | description:
- name: structValue | type: object | description:
- name: listValue | type: ListValue | description:
- name: values | type: array | description:
- name: purchaseLimitExceeded | type: boolean | description: Whether this previewed order would exceed the permitted amount of purchases available for this plan for this buyer. Always `false` for plans that do not have purchase limits.
Possible Errors:
HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: invalid_sort_field | Description: Invalid sort field specified.
HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: undefined_not_allowed | Description: Undefined values aren't allowed.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: MISSING_BUSINESS_ADDRESS_STATE | Description: Business address state is missing.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: MISSING_BUSINESS_ADDRESS_COUNTRY | Description: Business address country is missing.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_INVALID_SUBTOTAL | Description: Subtotal is invalid for the applied coupon.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_NOT_APPLICABLE_FOR_PLAN | Description: Coupon can't be applied to this plan.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_DOES_NOT_EXIST | Description: Coupon doesn't exist.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_HAS_EXPIRED | Description: Coupon has expired.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_IS_NOT_ACTIVE_YET | Description: Coupon isn't active yet.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_LIMIT_PER_CUSTOMER_EXCEEDED | Description: Coupon limit per customer exceeded.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_USAGE_EXCEEDED | Description: Coupon usage limit exceeded.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: ERROR_COUPON_IS_DISABLED | Description: Coupon is disabled and can't be applied.
HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: PRICING_PLANS_NOT_INSTALLED | Description: Pricing Plans app isn't installed on the site.
```
### Examples
### Create an offline order preview with options (with elevated permissions)
```javascript
import { orders } from '@wix/pricing-plans';
import { auth } from '@wix/essentials';
/* Sample planId value: 'd2fa5805-0d1a-4cfb-9b43-e683cf5fa990'
*
* Sample memberId value: '554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4'
*
* Sample options value:
* {
* couponCode: 'seasonal',
* startDate: new Date()
* }
*/
const elevatedGetOfflineOrderPreview = auth.elevate(orders.getOfflineOrderPreview);
export async function myGetOfflineOrderPreviewFunction(planId, memberId, options) {
try {
const orderPreview = await elevatedGetOfflineOrderPreview(planId, memberId, options);
return orderPreview;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "order": {
* "_createdDate": "2024-02-01T07:58:49.777Z",
* "_id": "00000000-0000-0000-0000-000000000000",
* "_updatedDate": "2024-02-01T07:58:49.777Z",
* "autoRenewCanceled": false,
* "buyer": {
* "contactId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4",
* "memberId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4"
* },
* "currentCycle": {
* "endedDate": "2024-02-15T07:58:49.387Z",
* "index": 0,
* "startedDate": "2024-02-01T07:58:49.387Z"
* },
* "formData": {
* "fomrId":
* "submissionData": {
* "email_0fd2": "Jboss@email.com",
* "form_field_aa30": false,
* "first_name_c551": "Jason",
* "last_name_78e9": "Bollinger",
* "phone_8cf1": "212-909-2222"
* },
* "submissionId": "10206732-e789-40e9-957d-2c7f3398efc6"
* },
* "freeTrialDays": 14,
* "lastPaymentStatus": "PAID",
* "pausePeriods": [],
* "planDescription": "The value plan",
* "planId": "d2fa5805-0d1a-4cfb-9b43-e683cf5fa990",
* "planName": "Silver Membership - Monthly",
* "planPrice": "100",
* "status": "ACTIVE",
* "orderMethod": "UNKNOWN",
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 1
* },
* "price": {
* "coupon": {
* "code": "seasonal",
* "amount": "95.00",
* "_id": "8673834a-a5c6-4e77-af9c-83f9bf609659"
* },
* "total": "30.00",
* "proration": "0",
* "fees": [
* {
* "name": "Setup Fee",
* "amount": "25"
* }
* ],
* "currency": "USD",
* "subtotal": "125.00",
* "discount": "95.00"
* }
* },
* {
* "duration": {
* "cycleFrom": 2
* },
* "price": {
* "coupon": {
* "code": "seasonal",
* "amount": "95.00",
* "_id": "8673834a-a5c6-4e77-af9c-83f9bf609659"
* },
* "total": "5.00",
* "proration": "0",
* "fees": [],
* "currency": "USD",
* "subtotal": "100.00",
* "discount": "95.00"
* }
* }
* ]
* "subscription": {
* "cycleCount": 0,
* "cycleDuration": {
* "count": 1,
* "unit": "MONTH"
* }
* }
* },
* "startDate": "2024-02-01T07:58:49.387Z",
* "status": "ACTIVE",
* "subscriptionId": "00000000-0000-0000-0000-000000000000",
* "type": "OFFLINE",
* },
* "purchaseLimitExceeded": false
* }
*/
```
### Create an offline order preview with options
```javascript
import { orders } from '@wix/pricing-plans';
/* Sample planId value: 'd2fa5805-0d1a-4cfb-9b43-e683cf5fa990'
*
* Sample memberId value: '554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4'
*
* Sample options value:
* {
* couponCode: 'seasonal',
* startDate: new Date()
* }
*/
export async function myGetOfflineOrderPreviewFunction(planId, memberId, options) {
try {
const orderPreview = await orders.getOfflineOrderPreview(planId, memberId, options);
return orderPreview;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "order": {
* "_createdDate": "2024-02-01T07:58:49.777Z",
* "_id": "00000000-0000-0000-0000-000000000000",
* "_updatedDate": "2024-02-01T07:58:49.777Z",
* "autoRenewCanceled": false,
* "buyer": {
* "contactId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4",
* "memberId": "554c9e11-f4d8-4579-ac3a-a17f7e6cb0b4"
* },
* "currentCycle": {
* "endedDate": "2024-02-15T07:58:49.387Z",
* "index": 0,
* "startedDate": "2024-02-01T07:58:49.387Z"
* },
* "formData": {
* "fomrId":
* "submissionData": {
* "email_0fd2": "Jboss@email.com",
* "form_field_aa30": false,
* "first_name_c551": "Jason",
* "last_name_78e9": "Bollinger",
* "phone_8cf1": "212-909-2222"
* },
* "submissionId": "10206732-e789-40e9-957d-2c7f3398efc6"
* },
* "freeTrialDays": 14,
* "lastPaymentStatus": "PAID",
* "pausePeriods": [],
* "planDescription": "The value plan",
* "planId": "d2fa5805-0d1a-4cfb-9b43-e683cf5fa990",
* "planName": "Silver Membership - Monthly",
* "planPrice": "100",
* "status": "ACTIVE",
* "orderMethod": "UNKNOWN",
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 1
* },
* "price": {
* "coupon": {
* "code": "seasonal",
* "amount": "95.00",
* "_id": "8673834a-a5c6-4e77-af9c-83f9bf609659"
* },
* "total": "30.00",
* "proration": "0",
* "fees": [
* {
* "name": "Setup Fee",
* "amount": "25"
* }
* ],
* "currency": "USD",
* "subtotal": "125.00",
* "discount": "95.00"
* }
* },
* {
* "duration": {
* "cycleFrom": 2
* },
* "price": {
* "coupon": {
* "code": "seasonal",
* "amount": "95.00",
* "_id": "8673834a-a5c6-4e77-af9c-83f9bf609659"
* },
* "total": "5.00",
* "proration": "0",
* "fees": [],
* "currency": "USD",
* "subtotal": "100.00",
* "discount": "95.00"
* }
* }
* ]
* "subscription": {
* "cycleCount": 0,
* "cycleDuration": {
* "count": 1,
* "unit": "MONTH"
* }
* }
* },
* "startDate": "2024-02-01T07:58:49.387Z",
* "status": "ACTIVE",
* "subscriptionId": "00000000-0000-0000-0000-000000000000",
* "type": "OFFLINE",
* },
* "purchaseLimitExceeded": false
* }
*/
```
### Create an offline order preview (with elevated permissions)
```javascript
import { orders } from '@wix/pricing-plans';
import { auth } from '@wix/essentials';
/* Sample planId value: '838f2c9d-c8d0-4799-a10a-e2f23849db10'
*
* Sample memberId value: '695568ff-1dc2-49ff-83db-2b518d35692b'
*/
const elevatedGetOfflineOrderPreview = auth.elevate(orders.getOfflineOrderPreview);
export async function myGetOfflineOrderPreviewFunction(planId, memberId) {
try {
const orderPreview = await elevatedGetOfflineOrderPreview(planId, memberId);
return orderPreview;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* order: {
* "_createdDate": "2024-01-31T08:51:46.516Z",
* "_id": "00000000-0000-0000-0000-000000000000",
* "_updatedDate": "2024-01-31T08:51:46.516Z",
* "autoRenewCanceled": false,
* "buyer": {
* "contactId": "695568ff-1dc2-49ff-83db-2b518d35692b",
* "memberId": "695568ff-1dc2-49ff-83db-2b518d35692b"
* },
* "currentCycle": {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* },
* "cycles": [
* {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* }
* ],
* "endDate": "2026-03-01T08:51:46.516Z",
* "earliestEndDate": "2026-03-01T08:51:46.516Z",
* "formData": {
* "submissionData": {}
* },
* "freeTrialDays": 30,
* "lastPaymentStatus": "PAID",
* "order": {
* "autoRenewCanceled": false,
* "buyer": {
* "contactId": "695568ff-1dc2-49ff-83db-2b518d35692b",
* "memberId": "695568ff-1dc2-49ff-83db-2b518d35692b"
* },
* "currentCycle": {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* },
* "cycles": [
* {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* }
* ],
* "endDate": "2026-03-01T08:51:46.516Z",
* "earliestEndDate": "2026-03-01T08:51:46.516Z",
* "formData": {
* "submissionData": {}
* },
* "freeTrialDays": 30,
* "lastPaymentStatus": "PAID",
* "orderMethod": "UNKNOWN",
* "orderType": "OFFLINE",
* "pausePeriods": [],
* "planDescription": "Complete with all features. One month free trial.",
* "planId": "838f2c9d-c8d0-4799-a10a-e2f23849db10",
* "planName": "Premium Plan - annual - 30 day trial",
* "planPrice": "500",
* "priceDetails": {
* "currency": "USD",
* "discount": "0",
* "freeTrialDays": 30,
* "planPrice": "500",
* "subtotal": "500.00",
* "total": "500.00",
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 2
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "500.00",
* "total": "500.00"
* }
* }
* ],
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "seller": {
* "subscriptionId": "00000000-0000-0000-0000-000000000000"
* },
* "startDate": "2024-01-31T08:51:46.516Z",
* "status": "ACTIVE",
* "statusNew": "ACTIVE",
* "type": "OFFLINE"
* },
* "orderMethod": "UNKNOWN",
* "pausePeriods": [],
* "planDescription": "Complete with all features. One month free trial.",
* "planId": "838f2c9d-c8d0-4799-a10a-e2f23849db10",
* "planName": "Premium Plan - annual - 30 day trial",
* "planPrice": "500",
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 2
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "500.00",
* "total": "500.00"
* }
* }
* ],
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "startDate": "2024-01-31T08:51:46.516Z",
* "status": "ACTIVE",
* "statusNew": "ACTIVE",
* "subscriptionId": "00000000-0000-0000-0000-000000000000",
* "type": "OFFLINE"
* }
* "purchaseLimitExceeded": false
* }
*/
```
### Create an offline order preview
```javascript
import { orders } from '@wix/pricing-plans';
/* Sample planId value: '838f2c9d-c8d0-4799-a10a-e2f23849db10'
*
* Sample memberId value: '695568ff-1dc2-49ff-83db-2b518d35692b'
*/
export async function myGetOfflineOrderPreviewFunction(planId, memberId) {
try {
const orderPreview = await orders.getOfflineOrderPreview(planId, memberId);
return orderPreview;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* order: {
* "_createdDate": "2024-01-31T08:51:46.516Z",
* "_id": "00000000-0000-0000-0000-000000000000",
* "_updatedDate": "2024-01-31T08:51:46.516Z",
* "autoRenewCanceled": false,
* "buyer": {
* "contactId": "695568ff-1dc2-49ff-83db-2b518d35692b",
* "memberId": "695568ff-1dc2-49ff-83db-2b518d35692b"
* },
* "currentCycle": {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* },
* "cycles": [
* {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* }
* ],
* "endDate": "2026-03-01T08:51:46.516Z",
* "earliestEndDate": "2026-03-01T08:51:46.516Z",
* "formData": {
* "submissionData": {}
* },
* "freeTrialDays": 30,
* "lastPaymentStatus": "PAID",
* "order": {
* "autoRenewCanceled": false,
* "buyer": {
* "contactId": "695568ff-1dc2-49ff-83db-2b518d35692b",
* "memberId": "695568ff-1dc2-49ff-83db-2b518d35692b"
* },
* "currentCycle": {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* },
* "cycles": [
* {
* "endedDate": "2024-03-01T08:51:46.516Z",
* "index": 0,
* "startedDate": "2024-01-31T08:51:46.516Z"
* }
* ],
* "endDate": "2026-03-01T08:51:46.516Z",
* "earliestEndDate": "2026-03-01T08:51:46.516Z",
* "formData": {
* "submissionData": {}
* },
* "freeTrialDays": 30,
* "lastPaymentStatus": "PAID",
* "orderMethod": "UNKNOWN",
* "orderType": "OFFLINE",
* "pausePeriods": [],
* "planDescription": "Complete with all features. One month free trial.",
* "planId": "838f2c9d-c8d0-4799-a10a-e2f23849db10",
* "planName": "Premium Plan - annual - 30 day trial",
* "planPrice": "500",
* "priceDetails": {
* "currency": "USD",
* "discount": "0",
* "freeTrialDays": 30,
* "planPrice": "500",
* "subtotal": "500.00",
* "total": "500.00",
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 2
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "500.00",
* "total": "500.00"
* }
* }
* ],
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "seller": {
* "subscriptionId": "00000000-0000-0000-0000-000000000000"
* },
* "startDate": "2024-01-31T08:51:46.516Z",
* "status": "ACTIVE",
* "statusNew": "ACTIVE",
* "type": "OFFLINE"
* },
* "orderMethod": "UNKNOWN",
* "pausePeriods": [],
* "planDescription": "Complete with all features. One month free trial.",
* "planId": "838f2c9d-c8d0-4799-a10a-e2f23849db10",
* "planName": "Premium Plan - annual - 30 day trial",
* "planPrice": "500",
* "pricing": {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 2
* },
* "price": {
* "currency": "USD",
* "discount": "0",
* "fees": [],
* "proration": "0",
* "subtotal": "500.00",
* "total": "500.00"
* }
* }
* ],
* "subscription": {
* "cycleCount": 2,
* "cycleDuration": {
* "count": 1,
* "unit": "YEAR"
* }
* }
* },
* "startDate": "2024-01-31T08:51:46.516Z",
* "status": "ACTIVE",
* "statusNew": "ACTIVE",
* "subscriptionId": "00000000-0000-0000-0000-000000000000",
* "type": "OFFLINE"
* }
* "purchaseLimitExceeded": false
* }
*/
```
### getOfflineOrderPreview (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).
```javascript
import { createClient } from '@wix/sdk';
import { orders } from '@wix/pricing-plans';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed
const myWixClient = createClient ({
modules: { orders },
// Include the auth strategy and host as relevant
});
async function getOfflineOrderPreview(planId,memberId,options) {
const response = await myWixClient.orders.getOfflineOrderPreview(planId,memberId,options);
};
```
---