Automatic location detection for pricing pages

When previewing prices without passing location information, Paddle.js now automatically detects visitor location based on their IP address and returns localized prices.

What's new?

We've updated the Paddle.PricePreview() and Paddle.TransactionPreview() methods so that they automatically detect visitor location based on their IP address, then returns localized prices for that location.

How it works

You can use the Paddle.PricePreview() and Paddle.TransactionPreview() methods in Paddle.js to get localized prices for pricing pages or other pages on your website. You can pass location information to Paddle.js by including a countryCode with your request, passing existing customer and address IDs, or using an IP address.

When you pass an IP address, Paddle fetches location information using the IP address to estimate tax and localized pricing.

Previously, you had to manually capture a visitor IP address and pass it to Paddle.js using a service like ipify. If omitted, we returned the base price for any items passed.

With this update, Paddle.js now automatically detects a visitor IP address for you and returns localized prices. This means you don't need to capture an IP address yourself — Paddle does it for you.

We handle location detection from IP addresses when previewing prices in the same way as when opening a checkout, meaning customers see the same prices on a pricing page as they do when they land on checkout.

You can still pass an IP address to Paddle.PricePreview() or Paddle.TransactionPreview(). When you do this, Paddle.js uses the IP address that you pass to determine location rather than automatically detecting an IP address.

Summary of changes

MethodChangeDetails
Paddle.PricePreview()Behavior changeLocation automatically detected if not supplied.
Paddle.TransactionPreview()Behavior changeLocation automatically detected if not supplied.

Next steps

This change is live in Paddle.js now. You don't need to do anything to get the latest version of Paddle.js — we serve the latest version automatically.

You shouldn't need to make any changes as a result of this update. If your pricing page implementation captures and passes an address to Paddle.js, it uses the IP address you pass rather than automatically detecting one. When next reviewing your integration, we recommend evaluating the new behavior by removing your IP detection code.

Related pages