Paddle Billing

Preview transactions using Paddle.js

Build advanced, cart-style pricing pages or other pages that present overall totals using a new method in Paddle.js. No need to make server-side calls to the Paddle API.

What's new?

We added a new Paddle.TransactionPreview() method to Paddle.js that you can use to get a transaction preview for items and location information.

It's ideal for building cart-style pricing pages and other pages in your app that present overall totals for items and location information.

How it works

You can use the transaction preview operation in the Paddle API to return a transaction preview for a list of prices given location information. It's typically used for previewing overall totals for a list of items without creating a transaction entity.

The new Paddle.TransactionPreview() method lets you use Paddle.js to get a transaction preview. It accepts a parameter for a request that shares the same request body as the preview a transaction operation in the API, except field names must be camelCase. It returns a promise that contains an object that matches the response from the preview a transaction operation, with camelCase field names.

This means you can get transaction previews using Paddle.js only. You don't need to make any server-side requests to the Paddle API. It's especially useful for creating more advanced, dynamic pricing pages where users can build their own plans by picking items and adjusting quantities.

What about Paddle.PricePreview()?

The Paddle.PricePreview() method is specifically designed for building simple pricing pages, using the preview prices operation. Paddle.TransactionPreview() can be used to build pricing pages, but is typically better for more advanced, cart-style pricing pages where users can build their own plans.


This example includes a request with two items where the country code is the United States and the currency code is USD. One of the items is excluded from the totals using the includeInTotals field. It also passes a discount.

The request is passed to Paddle.TransactionPreview(), which returns a promise. It prints the response to the console.

Next steps

This change is live in Paddle.js now, so you can start using Paddle.TransactionPreview() when you're ready.

You don't need to do anything to get the latest version of Paddle.js — we serve the latest version automatically.

Learn more