# Welcome to Uppercut

## Overview

Uppercut's tracking system is an easy way to attribute new customer and sales to their affiliates. To do so, you need to follow the two-step setup.

1. A basic script setup that tracks new referrals and signups
2. An API integration or pre-built integration that helps attribute new sales to the right affiliate

The entire setup should take you **10 minutes** and works with any tech stack and payment provider.

## Basic Setup

{% content-ref url="/pages/so3vWFZFAsIzaPHLjzn8" %}
[Tracking Script](/integration/tracking-script)
{% endcontent-ref %}

## Track Sales

We've put together some helpful guides for you to get setup with our product quickly and easily.

{% content-ref url="/pages/QLvF0NACbgMjWEGPr8HA" %}
[Track Sales (API)](/integration/track-sales-api)
{% endcontent-ref %}

{% content-ref url="/pages/GUPJg6BS4QVSjWnXmkLZ" %}
[Track Sales (Stripe)](/integration/track-sales-stripe)
{% endcontent-ref %}


# Tracking Script

Follow the instructions on your dashboard to set up and verify your Uppercut tracking installation. The basic setup consists of two steps.

### Add tracking script to your website

Add the Uppercut tracking script to the \<head/> section of your website. The exact tracking script is displayed to you during your setup, but looks a little bit like this.

<pre class="language-html" data-overflow="wrap" data-line-numbers><code class="lang-html"><strong>&#x3C;script async src="https://uppercut.co/uc.js" data-uppercut="&#x3C;your-company-id>">&#x3C;/script>
</strong></code></pre>

The job of the tracking script is to track referrals coming from your affiliate's to your website, and placing tracking cookies in the browsers of those referred users.

#### Dealing with subdomains

If your app sprawl across multiple subdomains (i.e. domain.com and app.domain.com), you can add the data-domains attribute to your tracking script, and we'll make sure tracking works across pages as well.

{% code overflow="wrap" lineNumbers="true" %}

```markup
<script [...] data-domains="domain.com,app.domain.com"></script>
```

{% endcode %}

### Track signups

When the user signs up for your service – be it for a trial, a free account or even already the full paid experience, you should track the user in the Uppercut system so future charges can be attributed to their respective affiliate.

Typically, this is on a "thank you" page, onboarding page or on first sign in – a page that's only displayed once during the signup.  However, it's also possible to send this call multiple times, which will just cause the record to get updated.

```html
<script type="text/javascript">
    window.addEventListener('load', function() {
      Uppercut.signup({
          email: 'customer@example.com', 
          userId: '1234'
      });
    });
</script>
```

You can add *either* the email or the userId as only one of the two are mandatory. However, for data integrity, it is recommended to do both.

The user ID is typically a unique identifier provided by your backend, or an external billing system.

#### What happens if the user's email changes?

As long as you set the *userId,* our system will be able to attribute sales to the right user. It is recommended you keep track of the original signup email.

### Track sales

Signups do not qualify for any sales-based commissions, yet. To start tracking and paying out commissions, you should consult one of the next guides on tracking sales.


# Track Sales (API)

{% hint style="info" %}
The API-based tracking might require a developer on your team. If you do not have any development experience or are using pre-built themes, consider using a pre-built integration like [Track Sales (Stripe)](/integration/track-sales-stripe)
{% endhint %}

The API is an easy lightweight way of tracking new sales and attributing commissions to your affiliates. The integration only takes two steps.

### Grab your API key

API keys can be generated through your dashboard. The key will only be shown to you once, so make sure you copy and save it somewhere save.

You'll use the API key to make authenticated calls to our API, sending it in the request header.

```
Authorization: Api-Key <API_KEY>
```

### Track sales

When a new sale is made, send the purchase information to our API to convert it into a commission.

Note – send all new sales to this endpoint. We'll do our job in making sure only referred sales are being collected in the program.

#### Parameters

* **event\_id**: A unique identifier for this sale, can for example be the payment ID from your external billing system or an automatically generated identifier you're keeping track of.
* **amount**: USD amount of the *sale*. We'll use this value to calculate the commission according to your campaign settings.
* **email:** Email of the user. Should correspond to the email tracked when [Tracking Script](/integration/tracking-script#track-signups)
* **userId*****:*** User ID as it was set during [Tracking Script](/integration/tracking-script#track-signups), can be alphanumerical and include special characters.

Only one of "email" and "userId" is required. However, it is recommended you add both.

{% tabs %}
{% tab title="JavaScript" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
fetch('https://app.uppercut.co/api/track-sale', {
  method: 'POST',
  headers: {
    'Authorization': 'Api-Key <API_KEY>',
    'Content-type': 'application/json'
  },
  body: JSON.stringify({
    'event_id': '<payment_id>',
    'amount': 130,
    'email': 'customer@example.com',
    'userId': '1234'
  })
});
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}

<pre class="language-python" data-overflow="wrap" data-line-numbers><code class="lang-python">import requests

headers = {
    'Authorization': 'Api-Key &#x3C;API_KEY>'
}

json_data = {
    'event_id': '&#x3C;payment_id>',
    'amount': 130.0,
    'email': 'customer@example.com',
    'userId': '1234'
}

<strong>requests.post('https://app.uppercut.co/api/track-sale', headers=headers, json=json_data)
</strong></code></pre>

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'json'

uri = URI('https://app.uppercut.co/api/track-sale')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Api-Key <API_KEY>'

req.body = {
  'event_id' => '<payment_id>',
  'amount' => 130,
  'email' => 'customer@example.com',
  'userId' => '1234'
}.to_json

req_options = {
  use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(req)
end
```

{% endtab %}

{% tab title="curl" %}
{% code overflow="wrap" lineNumbers="true" %}

```sh
curl -XPOST -H 'Authorization: Api-Key <API_KEY>' -H "Content-type: application/json" -d '{"event_id": "<payment_id>", "amount": 130.0, "email": "customer@example.com" "userId": "1234"}' 'https://app.uppercut.co/api/track-sale'
```

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

### Track refunds (optional)

When a refund happens, you can decide to take back the commission as well. This is recommended when your product receives many refund requests.

#### Parameters

* **event\_id**: The event ID you originally used to track the sale.

{% tabs %}
{% tab title="JavaScript" %}
{% code overflow="wrap" lineNumbers="true" %}

```javascript
fetch('https://app.uppercut.co/api/track-refund', {
  method: 'POST',
  headers: {
    'Authorization': 'Api-Key <API_KEY>',
    'Content-type': 'application/json'
  },
  body: JSON.stringify({
    'event_id': '<payment_id>'
  })
});

```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" lineNumbers="true" %}

```python
import requests

headers = {
    'Authorization': 'Api-Key <API_KEY>'
}

json_data = {
    'event_id': '<payment_id>',
}

response = requests.post('https://app.uppercut.co/api/track-refund', headers=headers, json=json_data)

```

{% endcode %}
{% endtab %}

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

```ruby
require 'net/http'
require 'json'

uri = URI('https://app.uppercut.co/api/track-refund')
req = Net::HTTP::Post.new(uri)
req.content_type = 'application/json'
req['Authorization'] = 'Api-Key <API_KEY>'

# The object won't be serialized exactly like this
# req.body = '{"event_id": "<payment_id>"}'
req.body = {
  'event_id' => '<payment_id>'
}.to_json

req_options = {
  use_ssl: uri.scheme == 'https'
}
res = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
  http.request(req)
end
```

{% endcode %}
{% endtab %}

{% tab title="curl" %}
{% code overflow="wrap" lineNumbers="true" %}

```sh
curl -XPOST -H 'Authorization: Api-Key <API_KEY>' -H  -H "Content-type: application/json" -d '{"event_id": "<payment_id>"}' 'https://app.uppercut.co/api/track-refund'
```

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


# 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 %}


# Merchant MCP

OAuth-secured Model Context Protocol for Uppercut merchants. Connect Claude, Cursor, or any MCP client to one team so agents can validate tracking, manage campaigns, review sales, list leads, and read

In-app setup: [app.uppercut.co/agents/mcp](https://app.uppercut.co/agents/mcp) · Agents overview: [app.uppercut.co/agents](https://app.uppercut.co/agents)

Related: [Track Sales (API)](https://docs.uppercut.co/integration/track-sales-api) · [Track Sales (Stripe)](https://docs.uppercut.co/integration/track-sales-stripe) · [Test your integration](https://docs.uppercut.co/guides/test-your-integration)

### Connect (Cursor / Claude)

1. Point the client at `https://app.uppercut.co` (one-click via `[.well-known/mcp.json](https://app.uppercut.co/.well-known/mcp.json)`) or add remote MCP URL `https://app.uppercut.co/mcp`.
2. The client registers via `/oauth/register` (Dynamic Client Registration), or discovers OAuth from `.well-known`.
3. Sign in to Uppercut, pick a team on the consent screen, then Allow access.
4. Example prompts: “Read my status board”, “List leads with email and affiliate”, “Validate tracking”, “Create a 20% campaign for Acme”.

Marketing discovery card (same shape) lives on [uppercut.co](https://uppercut.co/mcp). Canonical OAuth + MCP runtime is always `app.uppercut.co`.

#### Endpoints

| Purpose                       | URL                                                              |
| ----------------------------- | ---------------------------------------------------------------- |
| MCP server card (app origin)  | `https://app.uppercut.co/.well-known/mcp.json`                   |
| MCP                           | `https://app.uppercut.co/mcp`                                    |
| Authorize                     | `https://app.uppercut.co/oauth/authorize`                        |
| Token                         | `https://app.uppercut.co/oauth/token`                            |
| Register (DCR)                | `https://app.uppercut.co/oauth/register`                         |
| Authorization server metadata | `https://app.uppercut.co/.well-known/oauth-authorization-server` |
| Protected resource metadata   | `https://app.uppercut.co/.well-known/oauth-protected-resource`   |

#### Auth model

* OAuth 2.1 with PKCE (`S256`)
* Public clients (`token_endpoint_auth_method: none`) via Dynamic Client Registration
* Access tokens are **team-scoped** (one team per consent)
* Bearer token on `POST /mcp` (JSON-RPC)

#### Scopes

| Scope            | Access                                                                                               |
| ---------------- | ---------------------------------------------------------------------------------------------------- |
| `merchant:read`  | List and read tools                                                                                  |
| `merchant:write` | Create/update campaigns, remove affiliates, approve/reject sales, upload assets, payout funding link |

### Tools

#### Setup and status

| Tool                | Description                                                |
| ------------------- | ---------------------------------------------------------- |
| `validate_tracking` | Check click / signup / sale tracking status for the team   |
| `read_status_board` | Read merchant status-board tasks                           |
| `lookup_docs`       | Look up Uppercut docs (`docs.uppercut.co`, see `llms.txt`) |

#### Campaigns

| Tool              | Scope | Description                                                                                                                                     |
| ----------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| `create_campaign` | write | Create a campaign (`name`, `reward_type` = `percentage` \| `fixed`, `reward_value`; optional cookie/commission/holding windows and destination) |
| `get_campaign`    | read  | Campaign details including destinations                                                                                                         |
| `update_campaign` | write | Update editable campaign fields (including `archived`)                                                                                          |
| `add_destination` | write | Add a landing-page destination to a campaign                                                                                                    |

#### Affiliates

| Tool                | Scope | Description                                                                                      |
| ------------------- | ----- | ------------------------------------------------------------------------------------------------ |
| `list_affiliates`   | read  | List affiliates on the team’s programs                                                           |
| `search_affiliates` | read  | Search by name or email                                                                          |
| `get_affiliate`     | read  | Profile and metrics                                                                              |
| `remove_affiliate`  | write | Remove from all team programs, reject open sales, **permanently ban rejoin** (requires `reason`) |

#### Sales and leads

| Tool           | Scope | Description                                               |
| -------------- | ----- | --------------------------------------------------------- |
| `list_sales`   | read  | List commissions (optional `status`, `limit`)             |
| `approve_sale` | write | Approve a commission for payout                           |
| `reject_sale`  | write | Reject a commission                                       |
| `list_leads`   | read  | Signup leads (email / user ID) with affiliate attribution |

#### Assets and payouts

| Tool                | Scope | Description                                                  |
| ------------------- | ----- | ------------------------------------------------------------ |
| `list_assets`       | read  | List creative assets                                         |
| `upload_asset`      | write | Upload an asset from a public URL                            |
| `add_payout_method` | write | Create a Stripe Checkout link to add a payout funding method |

### Protocol notes

* Server name: `uppercut-merchant` (MCP protocol `2024-11-05`)
* Supported methods: `initialize`, `notifications/initialized`, `tools/list`, `tools/call`, `ping`
* Tool results return JSON text in MCP `content` blocks
* Write tools without `merchant:write` return a clear scope error

### Safety

* Prefer `validate_tracking` and `read_status_board` before suggesting setup work
* `remove_affiliate` needs a clear reason and permanently blocks that affiliate from rejoining
* Never invent affiliate, campaign, or commission IDs; call list/get tools first

### What MCP does not do

* Record sales or refunds (use the REST API or Stripe Connect)
* Span multiple teams in one OAuth grant
* Allow unauthenticated access


# Test your integration

Verify the full affiliate attribution flow (click → signup email → sale → commission) before going live – without charging customers your real product price.

### 1. Click an affiliate link

Open a tracking link in a private window. Confirm the click shows up in Uppercut.

### 2. Bind the visitor (browser console)

With the cookie still set on your site, paste one of these:

```javascript
// Email only
Uppercut.signup('test@example.com')
```

```javascript
// User ID only
Uppercut.signup({ userId: 'user_123' })
```

```javascript
// Both (recommended)
Uppercut.signup({ email: 'test@example.com', userId: 'user_123' })
```

### 3. Simulate a sale (no Stripe charge)

Create an API key under [**API keys**](https://app.uppercut.co/a/twosided/api-keys), then paste:

```bash
# Email only
curl -X POST https://app.uppercut.co/api/track-sale \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event_id": "test_001",
    "amount": 99.00,
    "currency": "usd",
    "email": "test@example.com"
  }'
```

```bash
# User ID only
curl -X POST https://app.uppercut.co/api/track-sale \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event_id": "test_001",
    "amount": 99.00,
    "currency": "usd",
    "userId": "user_123"
  }'
```

```bash
# Both (recommended)
curl -X POST https://app.uppercut.co/api/track-sale \
  -H "Authorization: Api-Key YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "event_id": "test_001",
    "amount": 99.00,
    "currency": "usd",
    "email": "test@example.com",
    "userId": "user_123"
  }'
```

Use the same `email` / `userId` as step 2. Change `event_id` if you run the test again.

### 4. Check the commission

A commission should appear for the test affiliate. Reject it so it is never paid out.

If nothing appears, signup was missing or the identifiers did not match.

### Optional: Stripe smoke test

After step 2 works:

**Email:** checkout with the same email (`customer_email` on Checkout).

**User ID:** set the same ID on Stripe:

```javascript
const session = await stripe.checkout.sessions.create({
  customer_email: 'test@example.com',
  metadata: { uppercut_user_id: 'user_123' },
  line_items: [/* ... */],
  mode: 'payment',
  success_url: 'https://yoursite.com/success',
})
```

```javascript
await stripe.customers.update('cus_xxx', {
  metadata: { uppercut_user_id: 'user_123' },
})
```

Use a $1 live Payment Link. Stripe test mode charges will not arrive correctly.


# Import affiliates

Our team can help you import your current affiliates into Uppercut. Imported affiliates are not managed by Uppercut, meaning that while tracking and commission calculation will run through Uppercut, payouts and vetting will not.

To start an import, email <imports@uppercut.co> with the following information, contacting us from your account email:

* Team ID (find this in your "team settings")
* CSV file in the following format&#x20;

| email | first\_name | last\_name | affiliate\_id |
| ----- | ----------- | ---------- | ------------- |
|       |             |            |               |
|       |             |            |               |
|       |             |            |               |

The import will take between 24h and 48h. On request, it is also possible to import existing referrals. It is currently not possible to import transaction history.


# Affiliate Payouts

How affiliates get paid on Uppercut: connect a bank account, claim when your balance is ready, and understand fees and timing.

### Before you claim

1. Open **Payouts** in the affiliate portal.
2. Choose a supported country and finish Stripe-hosted onboarding.
3. Wait until your available balance is at least **$25 USD** (after fees).
4. Review the fee preview (gross, Stripe fee, net), then claim.

Supported self-serve corridors today: **US, UK, EEA, Canada, and Switzerland**. Other countries show as coming soon.

### Minimum and claim window

| Rule              | Detail                                                                        |
| ----------------- | ----------------------------------------------------------------------------- |
| Minimum send      | **$25 USD** net after fees                                                    |
| Claimable balance | Approved commissions credit your balance even before a payout method is ready |
| Expiry            | Unclaimed credits expire after **365 days**                                   |
| Warning           | You get an email about **30 days** before expiry                              |

Expired balances are not recoverable.

### Fees

* **Stripe payout costs** come out of your payout before funds arrive (pass-through).
* The fee preview on **Payouts** shows gross, fee, and net before you claim.
* Merchants pay Uppercut’s platform fee separately. That does not change your listed commission rate in the portal.

### After you claim

Claims queue on the next payout run. Status updates appear on **Payouts**. If a transfer fails, reconnect or update your bank details through Stripe and try again once the method shows as ready.

### Tips

* Keep your payout country and bank details current so claims do not stall.
* If balance looks low, check **Sales** for commissions still in review or holding.
* Human support is in Crisp Chat (bottom-right in the app).

Related in-app: [Affiliate payouts](https://app.uppercut.co/affiliate/payouts) (sign in required).


