DemoPricingBlog
Sign in
Zahidul Islam - Author at Evendeals
Zahidul Islam

Founder, Evendeals

Jan 31, 2026

8 min read

Purchasing Power Parity API: Client-Side and Server-Side Integration

Implement custom PPP (purchasing power parity) pricing in your apps with our discount API—client-side for browsers, server-side for backends. A developer guide.

If you're building a SaaS, course platform, or digital product and want to offer location-based (PPP) discounts without locking into a pre-built banner, you need a way to fetch discount data and plug it into your own UI and checkout flow. That's what the Evendeals discount API is for: one endpoint, two modes— client-side (browser, no API key) and server-side (backend, API key)—so you can implement a custom PPP solution in any stack.

Purchasing Power Parity API: Client-Side and Server-Side Integration
Developer API — Purchasing Power Parity

Table of Contents

  • Why use a PPP API?
  • Client-side vs server-side
  • Client-side API
  • Server-side API
  • Response shape and errors
  • Best practices
  • Get started

Why use a PPP API?

Purchasing power parity (PPP) pricing means adjusting what you charge based on where the customer is, so the same product feels fairly priced in India, Brazil, or the US. For the full picture, see our Country-Based Pricing Guide and Why Your Business Needs Parity Pricing. Doing that yourself (country lists, discount tiers, geo lookup, VPN handling) is a lot of work. A PPP API gives you:

  • IP Address → discount mapping - You send ip address; we return the right discount percentage and coupon code for your product.
  • One integration for many surfaces - Web app, mobile app, server-rendered pages, or headless checkout can all call the same API.
  • VPN detection - Optional blocking of VPN users so discounts go to real local buyers (available in response and config).

Evendeals exposes a single discount endpoint that can be used either from the browser (no API key) or from your server (with an API key). Same response shape; different auth and parameters.

Client-side vs server-side

Client-side: The request comes from the user's browser. We determine country from the request. No API key; you only pass the current page URL. Best for: SPAs, static sites, or any front-end that needs to show a discount or coupon without a round-trip through your backend.

Server-side: The request comes from your server. You send the visitor's IP and your product ID; we return the discount for that IP/product. Requires an x-api-key header (Pro/Unlimited plans). Best for: server-rendered pages, checkout APIs, mobile backends, or when you already have the user IP and want to avoid exposing the discount call to the client.

Client-side API

Endpoint: GET https://www.evendeals.com/api/discount

Query parameters: url (required) — the full URL of the page the user is on (e.g. your checkout or pricing page). We use it to match your allowed domains and product.

No API key. Country is derived from the request.

Example (JavaScript)

const url = encodeURIComponent(window.location.href);
const res = await fetch(`https://www.evendeals.com/api/discount?url=${url}`);

if (res.status === 204) {
  // No discount for this visitor (wrong country, no IP, or no config)
  return null;
}

if (res.status !== 200) {
  throw new Error(`Discount API error: ${res.status}`);
}

const data = await res.json();

if (data.isVpn && data.settings?.blockVpn) {
  // Optional: don't show discount for VPN users
  return null;
}

if (data.discount) {
  // Use data.discount.couponCode, data.discount.discountAmount,
  // data.design, etc.
  return data;
}
return null;

Responses: 200 with JSON body (discount + design + settings), or 204 when no discount is available for that country. When VPN is detected and blocking is enabled, you still get 200 with { "isVpn": true } so you can hide the discount in your UI or ask user to remove VPN.

Server-side API

Endpoint: same, GET https://www.evendeals.com/api/discount

Query parameters: ip (required) — visitor IP address. productId (required) — your Evendeals product ID.

Headers: x-api-key: YOUR_API_KEY. API keys are per-organization and available on Pro and Unlimited plans; create or rotate them from the Evendeals dashboard (Product → Settings → API key).

Example (cURL)

curl -H 'x-api-key: YOUR_API_KEY' \
  'https://www.evendeals.com/api/discount?ip=203.0.113.50&productId=YOUR_PRODUCT_ID'

Example (Node.js)

async function getDiscountForUser(ip, productId) {
  const params = new URLSearchParams({ ip, productId });
  const res = await fetch(
    `https://www.evendeals.com/api/discount?${params}`,
    { headers: { 'x-api-key': process.env.EVENDEALS_API_KEY } }
  );

  if (res.status === 401) {
    const { error } = await res.json();
    throw new Error(`API key error: ${error}`);
  }
  if (res.status === 404) {
    const { error } = await res.json();
    // "Product not found" or "Country information not found"
    return null;
  }
  if (res.status !== 200) return null;

  const data = await res.json();
  if (data.discount && !(data.isVpn && data.settings?.blockVpn)) {
    return data;
  }
  return null;
}

Use the returned discount.couponCode (and optionally discount.discountAmount, discount.countryName, discount.countryFlag) in your checkout or pricing UI.

Response shape and errors

On success (200), the JSON body includes:

{
  "design": {
    "bgColor": "#0f766e",
    "fontColor": "#f0fdfa",
    "fontSize": "1rem",
    "htmlText": "Save {discount_amount} for {country} — use {coupon_code}",
    "showCloseIcon": true,
    "containerSelector": "body",
    "showPoweredBy": false,
    "productId": "prod_abc123"
  },
  "discount": {
    "countryCode": "IN",
    "countryName": "India",
    "countryFlag": "in.svg",
    "discountAmount": "30",
    "couponCode": "SAVE30"
  },
  "settings": {
    "blockVpn": true
  },
  "isVpn": false,
  "productId": "prod_abc123",
  "organizationId": "org_xyz",
  "url": "https://example.com/pricing"
}

Typical error responses:

  • 204 — No body. No discount or no country/IP.
  • 401 — { "success": false, "error": "Missing x-api-key header" | "Invalid API key" } (server-side only).
  • 404 — { "success": false, "error": "Product not found" | "Country information not found" } (server-side).

Best practices

  • Client-side: Always pass the real page URL (window.location.href or equivalent). We use it for domain/product matching and analytics.
  • Server-side: Use the client's real IP (e.g. X-Forwarded-For), not your server's IP. Never expose your API key in the browser.
  • Caching: Cache per user/session if you want (e.g. by IP or session ID). Avoid caching the same response for all users.
  • VPN: If settings.blockVpn is true and isVpn is true, don't show the discount or apply the coupon in checkout.
  • Rate limits: Usage is counted as API hits per plan (e.g. 10k/month free, 50k Essential, 100k Pro, unlimited Unlimited). Server-side requires Pro or Unlimited for API key access.

Get started

To use the client-side API: add your site and product in Evendeals, set your allowed URL(s) and country discounts, then call the endpoint with url from your front end. No API key needed.

To use the server-side API: upgrade to Pro or Unlimited, create an API key in the dashboard (Product → Settings → API key), and call the endpoint with ip, productId, and x-api-key. Same response shape—use it in your backend, server-rendered pages, or mobile API.

Either way, you get a single integration that returns the right PPP discount and coupon for the visitor so you can implement a custom parity pricing experience in your own app.

Get your API key on Evendeals

Footer

Boost your sales by showing personalized discount banners based on your customers location. Increase conversion rates by up to 30%.

X

Product

  • How It Works
  • Use Cases
  • Pricing
  • Glossary
  • llms.txt
  • Affiliate
  • ParityDeals Alternative

Support

  • Contact
  • Roadmap
  • Change Log
  • Request a Feature
  • System Status

Integrations

  • Any Website
  • WordPress
  • Framer
  • EzyCourse

© 2026 Evendeals. All rights reserved.

Thinkific

Legal

  • Privacy
  • Terms
  • Refund policy