Retrieves a plan's pricing.
The price preview uses the same logic as purchasing a plan, but the preview is not saved. Tax is only applied if the site has it configured. The price is returned in the pricing model format used for orders. Learn more about pricing models (REST|SDK).
Buyers do not have to be logged in to preview the price, and as such, the details returned are not buyer-specific. To generate a preview of a purchase for a specific buyer, call Get Offline Order Preview.
function getPricePreview(
planId: string,
options: GetPricePreviewOptions,
): Promise<GetPricePreviewResponse>;
ID of plan to preview.
Options for getting a price preview.
import { orders } from "wix-pricing-plans.v2";
/* Sample planId value: '838f2c9d-c8d0-4799-a10a-e2f23849db10' */
export async function myGetPricePreviewFunction(planId) {
try {
const pricePreview = await orders.getPricePreview(planId);
return pricePreview;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "prices": [
* {
* "duration": {
* "cycleFrom": 1,
* "numberOfCycles": 2
* },
* "price": {
* "currency": "USD",
* "discount": "0"
* "proration": "0",
* "subtotal": "500.00",
* "tax": {
* "name": "Tax",
* "includedInPrice": false,
* "rate": "6.5",
* "amount": "32.50"
* },
* "total": "532.50"
* }
* }
* ]
* }
*/
There are 8 errors with this status code.
This method may also return standard errors. Learn more about standard Wix errors.