> 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 # Method name: getOfflineOrderPreview(planId: string, memberId: string, options: GetOfflineOrderPreviewOptions) # Method package: wixPricingPlansV2 # Method menu location: wixPricingPlansV2 --> orders --> getOfflineOrderPreview # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-v2/orders/get-offline-order-preview.md # Method 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. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Create an offline order preview (dashboard page code) ```javascript import { orders } from 'wix-pricing-plans.v2'; /* 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 * } */ ``` ## Create an offline order preview (export from backend code) ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { orders } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; /* Sample planId value: '838f2c9d-c8d0-4799-a10a-e2f23849db10' * * Sample memberId value: '695568ff-1dc2-49ff-83db-2b518d35692b' */ const elevatedGetOfflineOrderPreview = elevate(orders.getOfflineOrderPreview); export const myGetOfflineOrderPreviewFunction = webMethod(Permissions.Anyone, async (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 with options ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { orders } from 'wix-pricing-plans.v2'; import { elevate } from 'wix-auth'; /* 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 = elevate(orders.getOfflineOrderPreview); export const myGetOfflineOrderPreviewFunction = webMethod(Permissions.Anyone, async (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 * } */ ``` ---