previewOnlineOrder( )

Provides a preview of an online order as if it was purchased.

The previewOnlineOrder() function returns a Promise that resolves to a temporary preview of the online order.

The buyer must be logged in to preview an online order.

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's _id and subscriptionId properties are displayed as a string of multiple zero characters (000000-0000).

If taxes are configured for the site, taxes are applied to the preview. If not, the tax previews asnull.

You can preview the order to check purchase limitations, but the limitations are not enforced for the preview. 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.

This function is available to the site owner and the buyer. Because the buyer is logged in, you do not need to specify the buyerId when previewing an online order. To get a general price preview for a plan that's not buyer-specific, use the previewPrice() function.

Method Declaration
Method Parameters

ID of the plan to be previewed.


Additional options for previewing the online order.

Return Type:Promise<OrderPreview>
Was this helpful?