Integrate with Stripe Checkout

Integrating Exportator coupons directly in your Stripe checkout increases your redemption rate. Here is how you can do it.

What's the Stripe Checkout integration

Exportator create a single coupon in Stripe to store your promotion's value. But how does this translates visually your prospects? They are 2 options:

  • Customer-facing promo codes. Exportator will generate one coupon and multiple promo codes. Each promo code will be unique to each prospect targeted by your campaign to avoid codes sharing. It will be shown in the Exportator banner on top of your site. Prospects will have to click to copy/paste their promo code, and paste it in your payment form.

  • Integrated Coupon. Exportator will generate a single Coupon and you'll load your checkout page with that coupon automatically embedded in. This saves your users from copy/pasting a promo code and allows you for better customization.

How to accept promo codes in Stripe Checkout

When loading your StripeCheckout session, Stripe gives you a number of options to customize your checkout. Add a allow_promotion_codes line and set it to true. Try launching a Checkout session: You'll see a new field in your payment form where customers can input a promo codes.

# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://dashboard.stripe.com/apikeys
Stripe.api_key = 'sk_test_51HwkyaBdXdgsJEBAJHUlt6kvpu87Ht...'

session = Stripe::Checkout::Session.create({
  payment_method_types: ['card'],
  line_items: [{
    price_data: {
      currency: 'usd',
      product_data: {
        name: 'T-shirt',
      },
      unit_amount: 2000,
    },
    quantity: 1,
  }],
  mode: 'payment',
  allow_promotion_codes: true,
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
})

Integrated Coupon

See Stripe documentation about integrating Coupons in Stripe Checkout.

When loading your StripeCheckout session, Stripe gives you a number of options to customize your checkout. Add a discount array with a coupon hash and include there the coupon_id given by Exportator.

# Set your secret key. Remember to switch to your live secret key in production.
# See your keys here: https://dashboard.stripe.com/apikeys
Stripe.api_key = 'sk_test_51HwkyaBdXdgsJEBAJHUlt6kvpu87Ht...'

session = Stripe::Checkout::Session.create({
  payment_method_types: ['card'],
  line_items: [{
    price: '{{PRICE_ID}}',
    quantity: 1,
  }],
  mode: 'payment',
  discounts: [{
    coupon: '{{COUPON_ID}}',
  }],
  success_url: 'https://example.com/success',
  cancel_url: 'https://example.com/cancel',
})

Last updated