Implementing Paddle PricePreview
Paddle's PricePreview method allows you to present localized pricing information to your customers based on their location. This is particularly useful for ensuring that users see prices in their local currency, including any applicable taxes.
Example Configuration
To utilize the PricePreview feature, you can use the following JavaScript code snippet:
Paddle.PricePreview({
items: [
{ priceId: 'pri_01gm81eqze2vmmvhpjg13bfeqg', quantity: 1 },
{ priceId: 'pri_01gm82kny0ad1tk358gxmsq87m', quantity: 1 }
],
customerIpAddress: '8.29.228.32'
});
Explanation of Parameters:
- items: An array of objects where each object represents a product with its unique
priceIdand the desiredquantity. - customerIpAddress: The IP address of the customer, which Paddle uses to determine the appropriate currency and tax rates.
This method will return a preview of the total price, allowing you to display it dynamically on your pricing page or checkout interface.
Conclusion
Integrating Paddle's PricePreview enhances the user experience by providing transparent pricing tailored to the customer's location. Make sure to replace the priceId values with those relevant to your products.