Stripe API

We also support promo code tracking if you're not using Stripe Checkout. If you're creating Stripe subscriptions directly by calling the Stripe API, it's straightforward to apply a Stripe promo code to a subscription at the time of subscription creation. This is a great option for mobile apps using Stripe that want to do affiliate tracking. App stores generally block affiliate link tracking, and promo codes are a great workaround.

Add a Promo Code During Subscription Creation

On your checkout screen, include a field where users can enter a promo code. On submission, call the promotion codes list API, and include the code parameter in your API call. From that API response, you will get the promo code ID, which looks like promo_...

Then, when calling the subscription creation API, include the promotion_code parameter and set it equal to the promo code ID from the first step.

Note that you can also apply a promo code using the subscription update API, and we will be able to attribute referrals the same way as if you used the subscription creation API.

Subscription Creation Request Body Example
  customer: 'cus_Na6dX7aXxi11N4',
  items: [
      price: 'price_1MowQULkdIwHu7ixraBm864M',
  promotion_code: 'promo_1MiM6KLkdIwHu7ixrIaX4wgn'

Once you've added the ability to add promo codes to your subscriptions, move on to Setting a Default Coupon Code.

Last updated