> 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: previewPrice(planId: string, couponCode: string) # Method package: wixPricingPlansBackend # Method menu location: wixPricingPlansBackend --> Checkout --> previewPrice # Method Link: https://dev.wix.com/docs/velo/apis/wix-pricing-plans-backend/checkout/preview-price.md # Method Description: Provides a preview of an order's pricing as if was purchased. The `previewPrice()` function returns a Promise that resolves to a temporary preview of the order's price. The price preview uses the same logic for calculating prices as used when purchasing a plan, but the preview is not saved. If [taxes are configured for the site](https://support.wix.com/en/article/pricing-plans-setting-up-tax-collection), taxes are applied to the preview. If not, the `tax` previews as `null`. Buyers do not have to be logged in to preview the price, as such, the details returned by this function are not buyer-specific. To generate a preview of a purchase for a specific buyer, use the [previewOfflineOrder()](wix-pricing-plans-backend/checkout/preview-offline-order) or [previewOnlineOrder()](wix-pricing-plans-backend/checkout/preview-online-order) functions. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Preview the pricing details for a plan to be purchased with a 10%-off coupon ```javascript import { Permissions, webMethod } from 'wix-web-module'; import { checkout } from 'wix-pricing-plans-backend'; // Sample planId value: '6d7537c5-beac-44a3-bea3-b947ddc56b31' // // Sample couponCode value: 'BACKTOSHAPE22' export const myPreviewPriceFunction = webMethod(Permissions.Anyone, async (planId, couponCode) => { try { const pricePreview = await checkout.previewPrice(planId, couponCode); const orderPricing = pricePreview.prices.price.total; const currency = pricePreview.prices.price.currency; return pricePreview; } catch (error) { console.error(error); } }); /* Promise resolves to: * * { * "price": { * "subtotal": "14.99", * "discount": "1.5", * "total": "13.49", * "planPrice": "14.99", * "currency": "USD", * "subscription": { * "cycleDuration": { * "count": 1, * "unit": "MONTH" * }, * "cycleCount": 0 * }, * "coupon": { * "code": "BACKTOSHAPE22", * "amount": "1.5", * "_id": "52f73ce1-9e31-40f7-b5d4-a621b4b4057d" * } * }, * "prices": [ * { * "duration": { * "cycleFrom": 1 * }, * "price": { * "subtotal": "14.99", * "coupon": { * "code": "BACKTOSHAPE22", * "amount": "1.5", * "_id": "52f73ce1-9e31-40f7-b5d4-a621b4b4057d" * }, * "discount": "1.5", * "total": "13.49", * "currency": "USD" * } * } * ] * } */ ``` ---