# completeRequirement(\[payload,])

This method allows you to mark a user's program requirement as completed.

#### How this methods issues rewards

On success, if the requirement belongs to a program/campaign objective, ChainVine will asynchronously check whether the user has completed enough requirements to mark an objective as completed.

```typescript
const campaignId = '02jd020jkd-302jdi2d-02ij0dj';

const requirementId = 'Hiodn2oD2dkmo2';

const completion = await userClient.completeRequirement({
    campaign: {
        id: campaignId
    },
    id: requirementId,
});
```

## 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="broken-reference">id of the program/campaign</a> requirement belongs to<br>Note: this campaign/program must belong to your account</td></tr><tr><td>id</td><td>required</td><td>string</td><td>the requirement id to complete</td></tr></tbody></table>

## Optional Params

These parameters can be passed in if you are sending custom data to ChainVine when completing a requirement programatically

<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>amount</td><td>optional</td><td>number</td><td>an amount to associate with the completion</td></tr><tr><td>fee</td><td>optional</td><td>number</td><td>an optional fee to pass into the SDK</td></tr><tr><td>transaction_hash</td><td>optional</td><td>string</td><td>The hash of the transaction that this completion should be linked to</td></tr><tr><td>token_address</td><td>optional</td><td>string</td><td>a token address (token, NFT, smart contract) that should be associated with this completion</td></tr><tr><td>external_identifier</td><td>optional</td><td>string</td><td>a user identifier known to your system, if passed in, ChainVine will associate this with the wallet address if none has been associated yet, this value will be returned to you if present</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>

## Examples

{% tabs %}
{% tab title="Browser" %}
In this approach, we complete a requirement ad-hoc for a user, by passing in a referrer\_id if one has been captured by a referral link beforehand.

If the referrer id is passed into the request, and no referral has ever been made between this user and any referrer, then a Referral will be created.

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

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

const client = new ChainvineClient(); //Make sure to whitelist your domain
const requirementId = 'Hiodn2oD2dkmo2';
const userClient = await client.syncUser(userWalletAddress);

const completion = await userClient.completeRequirement({
    campaign: {
        id: campaignId
    },
    id: requirementId
});

```

{% endtab %}

{% tab title="Server" %}
In this approach, we complete a requirement ad-hoc for a user, by passing in a referrer\_id if one has been captured by a referral link beforehand.

If the referrer id is passed into the request, and no referral has ever been made between this user and any referrer, then a Referral will be created.

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

const userWalletAddress = '0x293kdo0ij0';
const campaignId = '02jd020jkd-302jdi2d-02ij0dj';

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

const requirementId = 'Hiodn2oD2dkmo2';
const userClient = await client.syncUser(userWalletAddress);

const completion = await userClient.completeRequirement({
    campaign: {
        id: campaignId
    },
    id: requirementId
});

```

{% endtab %}
{% endtabs %}
