Skip to content

Stripe

Integrate GoPayLocal with Stripe for automatic PPP discount coupons.

Stripe is the most popular payment provider for SaaS. GoPayLocal creates Stripe coupons and promotion codes automatically, enabling both coupon-based and auto-apply discount flows.

  1. Get your Stripe secret key

    Go to Stripe Dashboard > Developers > API keys. Copy your Secret key.

    For testing, use the test mode key (starts with sk_test_).

  2. Connect in GoPayLocal

    Go to your GoPayLocal dashboard > Settings > Integrations > Stripe and click Connect. Enter your secret key in the dialog. Select Test environment if using a test key (sk_test_...).

    Click Test after connecting to verify your credentials.

  3. Create a campaign

    Create or edit a campaign and select Stripe as the payment provider. GoPayLocal creates:

    • A Coupon for each discount percentage (e.g., 30% off)
    • A Promotion Code for each coupon (e.g., PPP-INDIA-30)
  4. Verify in Stripe

    Check your Stripe Dashboard > Products > Coupons to see the auto-created coupons and promotion codes.

GoPayLocal creates Stripe coupons and promotion codes via the Stripe API:

// GoPayLocal creates a coupon
const coupon = await stripe.coupons.create({
percent_off: 30,
duration: 'repeating',
duration_in_months: 12,
metadata: { source: 'gopaylocal' },
});
// And a promotion code for the coupon
const promoCode = await stripe.promotionCodes.create({
coupon: coupon.id,
code: 'PPP-INDIA-30',
});

Pass the promotion code in the discounts array when creating a Checkout Session:

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',
});

Append the promo code as a URL parameter:

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

This pre-fills the promotion code in the Payment Link checkout — the visitor sees the discount already applied.

Use Stripe test mode keys (sk_test_*) during development:

  • Coupons and promotion codes are created in test mode
  • Use Stripe test card numbers for payments
  • All data is isolated from your live environment

Webhook handling for Stripe is planned. Currently, discount code creation and checkout integration work fully. Redemption tracking via webhooks is on the roadmap. | customer.discount.created | Track discount application |

The webhook endpoint is configured automatically when you connect Stripe.

  • Stripe limits promotion codes to one per checkout session
  • Coupons can be percentage-off or fixed-amount (GoPayLocal uses percentage-off)
  • Promotion codes can have restrictions (first-time customers, minimum amount, etc.) — GoPayLocal does not set these by default
  • Stripe charges standard processing fees on the discounted amount