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.
-
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_). -
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.
-
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)
-
Verify in Stripe
Check your Stripe Dashboard > Products > Coupons to see the auto-created coupons and promotion codes.
How Discounts Work
Section titled “How Discounts Work”GoPayLocal creates Stripe coupons and promotion codes via the Stripe API:
// GoPayLocal creates a couponconst coupon = await stripe.coupons.create({ percent_off: 30, duration: 'repeating', duration_in_months: 12, metadata: { source: 'gopaylocal' },});
// And a promotion code for the couponconst promoCode = await stripe.promotionCodes.create({ coupon: coupon.id, code: 'PPP-INDIA-30',});Auto-Apply
Section titled “Auto-Apply”Stripe Checkout Sessions
Section titled “Stripe Checkout Sessions”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',});Stripe Payment Links
Section titled “Stripe Payment Links”Append the promo code as a URL parameter:
https://buy.stripe.com/xxx?prefilled_promo_code=PPP-INDIA-30This pre-fills the promotion code in the Payment Link checkout — the visitor sees the discount already applied.
Test Mode
Section titled “Test Mode”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
Webhooks
Section titled “Webhooks”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.
Limitations
Section titled “Limitations”- 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