Skip to content

Auto-Apply Discounts

Apply PPP discounts automatically at checkout without coupon codes.

Auto-apply discounts remove friction from the checkout process by applying the PPP discount automatically — the visitor never needs to copy or enter a coupon code.

Coupon CodesAuto-Apply
Visitor experienceCopy code, paste at checkoutDiscount applied automatically
Conversion rateLower (some visitors don’t apply)Higher (zero friction)
SetupWorks with all providersProvider-specific implementation
FlexibilityVisitor decides when to useAlways applied for eligible visitors
Sharing riskCodes can be shared onlineLess risk (tied to checkout session)
  1. Visitor loads your pricing page
  2. GoPayLocal detects their country and discount
  3. Your checkout flow passes the discount to the payment provider
  4. The checkout page shows the discounted price automatically

Each payment provider implements auto-apply differently:

Checkout Sessions:

// Server-side: create a Checkout Session with discount
const session = await stripe.checkout.sessions.create({
line_items: [{ price: 'price_xxx', quantity: 1 }],
mode: 'subscription',
discounts: [{ promotion_code: 'promo_xxx' }],
success_url: 'https://yoursite.com/success',
cancel_url: 'https://yoursite.com/cancel',
});

Payment Links:

https://buy.stripe.com/xxx?prefilled_promo_code=PPP-INDIA-30

Checkout Overlay:

Paddle.Checkout.open({
items: [{ priceId: 'pri_xxx', quantity: 1 }],
discountCode: 'PPP-INDIA-30',
});

Price Overrides (native PPP):

Paddle can set per-country prices directly on Price objects via unitPriceOverrides, making auto-apply truly seamless — no discount code needed.

const session = await dodo.checkoutSessions.create({
product_id: 'prod_xxx',
discount_code: 'PPP-INDIA-30',
success_url: 'https://yoursite.com/success',
});
https://yourstore.lemonsqueezy.com/checkout/buy/xxx?checkout[discount_code]=PPP-INDIA-30
https://whop.com/yourproduct/?promoCode=PPP-INDIA-30

The general implementation pattern for auto-apply:

Step 1: Get the Discount Code from GoPayLocal

Section titled “Step 1: Get the Discount Code from GoPayLocal”
// Client-side
import { GoPayLocal } from '@gopaylocal/js';
const gpl = new GoPayLocal({ apiKey: 'gpl_pk_live_abc123' });
const data = await gpl.init();
const discountCode = data?.code; // "PPP-INDIA-30" or null
// When user clicks "Buy Now"
async function handleCheckout() {
const res = await fetch('/api/checkout', {
method: 'POST',
body: JSON.stringify({
planId: 'pro_monthly',
discountCode: gpl.getCode(), // Pass the GoPayLocal code
}),
});
const { checkoutUrl } = await res.json();
window.location.href = checkoutUrl;
}

Step 3: Apply in Checkout Session (Server-Side)

Section titled “Step 3: Apply in Checkout Session (Server-Side)”
// Server-side route handler
app.post('/api/checkout', async (req, res) => {
const { planId, discountCode } = req.body;
const session = await stripe.checkout.sessions.create({
line_items: [{ price: getPriceId(planId), quantity: 1 }],
mode: 'subscription',
...(discountCode && {
discounts: [{ promotion_code: await getPromoCodeId(discountCode) }],
}),
success_url: 'https://yoursite.com/success',
cancel_url: 'https://yoursite.com/cancel',
});
res.json({ checkoutUrl: session.url });
});
ProviderAuto-Apply Support
GumroadNo native auto-apply
ChargebeeNo URL-based auto-apply (possible via Chargebee.js)
PolarNo auto-apply

For these providers, use the banner + coupon code approach. The visitor copies the code from the banner and enters it manually at checkout.

  1. Always pass the discount code server-side — Don’t construct checkout URLs on the client with discount codes; a user could modify them
  2. Validate the discount — On your server, verify the discount code is valid before creating the checkout session
  3. Graceful fallback — If auto-apply fails, show the coupon code as a fallback
  4. Show the discount — Even with auto-apply, show the visitor that they’re getting a PPP discount (e.g., “Prices adjusted for India”)