# 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](https://stripe.com/docs/api/promotion_codes/list), 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](https://docs.stripe.com/api/subscriptions/create), 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](https://docs.stripe.com/api/subscriptions/update), and we will be able to attribute referrals the same way as if you used the subscription creation API.

{% code title="Subscription Creation Request Body Example" %}

```javascript
{
  customer: 'cus_Na6dX7aXxi11N4',
  items: [
    {
      price: 'price_1MowQULkdIwHu7ixraBm864M',
    },
  ],
  promotion_code: 'promo_1MiM6KLkdIwHu7ixrIaX4wgn'
}
```

{% endcode %}

Once you've added the ability to add promo codes to your subscriptions, move on to [Setting a Default Coupon Code](/affiliate-promo-codes-setup/setting-a-default-coupon-code.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.promotekit.com/affiliate-promo-codes-setup/stripe-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
