# claimEligibleEarnings(\[payload,])

This method allows you request a user's earnings to be paid out from your Gnosis Safe.

**Note** - this endpoint is asynchronous of the actual payouts from your Gnosis Safe, which occur on-chain. ChainVine handles reconciling earnings owed with those that are transferred successfully on-chain via this SDK method.

```typescript
const campaignId = 'aSlug123';

const campaign = {
  id: campaignId
}

const claim = await userClient.claimEligibleEarnings({campaign});
```

## Params

<table><thead><tr><th width="190">Param</th><th width="102">Required</th><th width="111">Type</th><th>Description</th></tr></thead><tbody><tr><td>campaign.id</td><td>required</td><td>string</td><td>the  <a href="/pages/662saYlawwXwhdwSI4rC">id of the program/campaign</a> requirement belongs to<br>Note: this campaign/program must belong to your account</td></tr></tbody></table>

## **Response**

<table><thead><tr><th width="180">Field</th><th width="141">Type</th><th>Description</th></tr></thead><tbody><tr><td>message</td><td>String</td><td>Ok status message on success</td></tr></tbody></table>

## How this method claims earnings for your user

* All unpaid earnings are flagged for pay-out
* Pay-outs are reflected on ChainVine asynchronously of the request&#x20;
* Earnings that are ***paid out*** successfully on chain are marked as paid out ChainVine side
* Earnings that ***fail*** on-chain are not marked as failed on ChainVine and can be re-attempted
* Earnings that are ***being*** paid out will not be retried while on-chain transfer confirmation is pending

## Examples

{% tabs %}
{% tab title="Browser" %}
In this approach, we claim a user's earnings on their behalf.

```typescript
import { ChainvineClient } from '@chainvine/sdk';

const userWalletAddress = '0x293kdo0ij0';
const campaignId = 'aSlug123';

// Generate your ChainvineClient instance
const client = new ChainvineClient(); //Make sure to whitelist your domain

const userClient = await client.syncUser(userWalletAddress);

const campaign = {
  id: campaignId
}

const claim = await userClient.claimEligibleEarnings({campaign});

```

{% endtab %}

{% tab title="Server" %}
In this approach, we claim a user's earnings on their behalf. Since we are in a server-side environment, we pass in the API Key to the ChainvineClient instance.

```typescript
import { ChainvineClient } from '@chainvine/sdk';

const userWalletAddress = '0x293kdo0ij0';

const campaignId = 'aSlug123';

// Generate your ChainvineClient instance
const client = new ChainvineClient({
    apiKey: '0dj03j000d'  // Your API Key
});

const userClient = await client.syncUser(userWalletAddress);

const campaign = {
  id: campaignId
}

const claim = await userClient.claimEligibleEarnings({campaign});

```

{% endtab %}
{% endtabs %}


---

# 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.chainvine.xyz/developers/sdk/classes-and-functions/chainvineuser/claimeligibleearnings-payload.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.
