SDK Reference

SDK Integration

The PriceParity SDK is a lightweight JavaScript snippet that detects a visitor's location, looks up the correct PPP discount, and injects a Paddle coupon code automatically at checkout.

Installation

Add the script tag to any page where Paddle checkout is triggered — place it before your Paddle.js script.

<script src="https://cdn.priceparity.net/v2/sdk.js" data-pp-key="YOUR_API_KEY" data-pp-product="YOUR_PADDLE_PRODUCT_ID" data-pp-api="https://api.priceparity.net" ></script>

Your API key is in Dashboard → Settings → API Key.

Script tag attributes

AttributeRequiredDescription
data-pp-keyYesYour PriceParity API key (Dashboard → Settings).
data-pp-productYesThe Paddle product or price ID to apply PPP discounts to.
data-pp-apiNoAPI base URL. Defaults to https://api.priceparity.net. Only change for self-hosted deployments.
data-pp-debugNoSet to "true" to enable console logs for troubleshooting.

How the SDK works

1

Async load

The script loads asynchronously and never blocks page rendering.

2

Geo detection

The SDK calls the PriceParity API with your API key and product ID. The server detects the visitor's country from their IP address.

3

Rule matching

The API checks your active pricing rules and tiers to find the correct discount percentage for that country.

4

Coupon injection

If a discount applies, the API returns a Paddle coupon code. The SDK passes it to Paddle Checkout automatically.

5

VPN protection

If VPN blocking is enabled on a tier, the API detects VPN/proxy IPs and skips the discount to prevent abuse.

Full example

A minimal checkout page with PriceParity + Paddle.js v2:

<!DOCTYPE html> <html> <head> <!-- Paddle.js v2 --> <script src="https://cdn.paddle.com/paddle/v2/paddle.js"></script> <script> Paddle.Environment.set("sandbox"); // remove in production Paddle.Initialize({ token: "YOUR_PADDLE_CLIENT_TOKEN" }); </script> <!-- PriceParity SDK --> <script src="https://cdn.priceparity.net/v2/sdk.js" data-pp-key="YOUR_API_KEY" data-pp-product="pri_XXXXXXXXXXXXXXXXXXXXXXX" data-pp-api="https://api.priceparity.net" ></script> </head> <body> <button onclick="openCheckout()">Buy now</button> <script> function openCheckout() { Paddle.Checkout.open({ items: [{ priceId: "pri_XXXXXXXXXXXXXXXXXXXXXXX", quantity: 1 }] // PriceParity injects the discount coupon automatically }); } </script> </body> </html>

Troubleshooting

No discount is applied

Check that the visitor's country has a matching tier in your pricing rule and the rule is active. Add data-pp-debug="true" to see console output.

SDK does nothing on localhost

The SDK only fires on public IPs. Use a VPN or deploy to a staging server to test geo-detection.

401 error in the browser console

Your API key is invalid or the product ID does not belong to this account. Verify both in Dashboard → Settings.

Trial quota exceeded

You have used all 200 evaluations in the current 30-day window. Upgrade to Pro for unlimited evaluations.

Coupon code is not applied at Paddle checkout

Ensure PriceParity SDK loads before Paddle.js. Check that your Paddle integration is using the Checkout.open() method — the SDK hooks into this call.

Still stuck? Email support →