> For the complete documentation index, see [llms.txt](https://docs.shoffi.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shoffi.app/the-shoffi-api/affiliate-payment-request.md).

# Affiliate Payment Request

## Create a payment request on behalf of an affiliate

<mark style="color:green;">`POST`</mark> `https://platform.shoffi.app/API/affiliate/requestPayment`

You can use this API to let affiliates request payments directly from your app or website if they have already earned more than the minimum withdrawal amount.

#### Request Body

| Name                                          | Type    | Description                               |
| --------------------------------------------- | ------- | ----------------------------------------- |
| apiKey<mark style="color:red;">\*</mark>      | String  | Your Shoffi app API Key                   |
| appId<mark style="color:red;">\*</mark>       | Integer | Your app ID                               |
| paypalEmail<mark style="color:red;">\*</mark> | String  | The PayPal email account of the affiliate |
| email<mark style="color:red;">\*</mark>       | String  | The affiliate email address               |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "affiliateNewTerms": {
        "revenueShare": 50,
        "cpi": 10,
        "limitPeriod": 24,
        "minWithdrawal": 50
    }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
    "status": 400,
    "message": "Error details"
}
```

{% endtab %}
{% endtabs %}

```
curl -X POST 'https://platform.shoffi.app/API/affiliate/requestPayment' \
-H 'Content-Type: application/json' \
-d '{
    "apiKey": "YourKey",
    "appId": 00000000,
    "affiliateDetails": {
        "email": "tobias@lutke.com",
        "paypalEmail": "tobias@lutke.com"
    }
}'
```

{% hint style="warning" %}
**Please Note!**\
Some affiliates have already added their PayPal email address to Shoffi. In that case, **the PayPal account stays the existing one**, not the one you sent in the request.

You can see the final PayPal email address in the response data.
{% endhint %}

## Response example

```json
200 OK
Content-Type: application/json
```

```json
{
    "affiliateDetails": {
        "email": "tobias@lutke.com",
        "firstName": "Tobias",
        "lastName": "Lütke",
        "nickName": "tobi"
    },
    "affiliatePerformance": {
        "appProfit": 39.8,
        "affiliateProfit": "7.96",
        "paidToAffiliate": 0,
        "linkViews": 3
    },
    "paypalAddress": "tobias@lutke.com"
}
```
