> For the complete documentation index, see [llms.txt](https://docs.uppercut.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uppercut.co/integration/track-sales-stripe.md).

# Track Sales (Stripe)

When using the Stripe integration, it is expected that you add the user's email when calling the signup script.

This way, the provided email is directly being matched with your Stripe records.

```html
<script type="text/javascript">
    await Uppercut.signup(email='customer@example.com', userId="1234")
</script>
```

No other action is required, although you can take additional optional steps to make your tracking more robust.

### Pre-set Stripe Customer Email

If you're using email-based tracking, it is recommended that you set the `customer_email` record when starting your Stripe checkout to warrant data consistency.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const session = await stripe.checkout.sessions.create({
  customer_email: 'customer@example.com',
  line_items: [
    .....
  ],
  mode: 'subscription',
  success_url: '....'
});
```

{% endtab %}

{% tab title="Python" %}

```python
stripe.checkout.Session.create(
  customer_email="customer@example.com",
  line_items=[....],
  mode="subscriptions",
  success_url="...."
)
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
Stripe::Checkout::Session.create({
  success_url: '...',
  line_items: [....],
  mode: 'subscription',
  customer_email: 'customer@example.com'
})
```

{% endtab %}
{% endtabs %}

### Use ID-based tracking

Email-based tracking can have several downsides, such as privacy concerns and data inconsistencies when emails are being changed.

You can set the user's ID and use it as a more robust form of tracking. You have two options to do so.

**Pass user ID in Stripe checkout**

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const session = await stripe.checkout.sessions.create({
  metadata: { uppercut_user_id: '1234' },
  line_items: [
    .....
  ],
  mode: 'subscription',
  success_url: '....'
});
```

{% endtab %}

{% tab title="Python" %}

```python
stripe.checkout.Session.create(
  metadata={"uppercut_user_id": "1234" },
  line_items=[....],
  mode="subscriptions",
  success_url="...."
)
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
Stripe::Checkout::Session.create({
  success_url: '....',
  line_items: [...],
  mode: 'subscription',
  metadata: { uppercut_user_id: '1234' }
})
```

{% endtab %}
{% endtabs %}

**Manually add user ID to Stripe customer**

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const customer = await stripe.customers.update(
  '.....',
  {
    metadata: {
      uppercut_user_id: '1234',
    },
  }
);
```

{% endtab %}

{% tab title="Python" %}

<pre class="language-python"><code class="lang-python"><strong>stripe.Customer.modify(
</strong>  "......",
  metadata={"uppercut_user_id": "1234"},
)
</code></pre>

{% endtab %}

{% tab title="Ruby" %}
{% code overflow="wrap" %}

```ruby
Stripe::Customer.update('.....', {metadata: {uppercut_user_id: '1234'}})
```

{% endcode %}
{% endtab %}
{% endtabs %}
