ChainVine API Docs
  • Chainvine
    • Product and Features
    • Technical Overview
  • ⚙️Developers
    • 🔨Use Cases
      • Leverage cookies
      • Link Claimer/Referrer
      • Record Link Click
      • Generate a Referrer Link
      • Record a Transfer Event
      • Complete a Requirement
    • 🖼️Embedded Widget
      • Implementation
      • FAQ
    • 🧰SDK
      • Implementation
      • Configuring the Client
      • Classes and Functions
        • Utility Methods
        • ChainvineClient
          • getReferralUrl(walletAddress)
          • recordClick(referrer)
          • linkReferrer([payload,])
          • referralConversion([payload,])
          • syncUser(walletAddress)
          • getCampaignReferralStats([payload,])
        • ChainvineUser
          • Initializing the client
          • joinCampaign([campaignParams,])
          • getRequirement([payload,])
          • getUserStats([payload,])
          • verifyRequirement([payload,])
          • completeRequirement([payload,])
          • claimEligibleEarnings([payload,])
          • transferEvent([payload,])
          • referral([campaignParams,])
            • linkToReferrer(referrer)
            • url()
          • setRewardTiersOverride([payload,])
        • Errors
        • Authentication
          • Getting your API Key
          • Allow-listing a domain
      • FAQ
    • 🪝Webhooks
    • 📔Open API Specification
  • Rewards
    • Claiming For Users
      • On ChainVine
Powered by GitBook
On this page
  • Params
  • Response
  • Examples
  1. Developers
  2. SDK
  3. Classes and Functions
  4. ChainvineUser

verifyRequirement([payload,])

Attempts to verify a requirement for the user

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.

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

const requirementId = 'Hiodn2oD2dkmo2';

const verify = await userClient.verifyRequirement(
   {
      id: requirementId,
      campaign: {
         id: campaignId
      }
   }
)

Params

Field
Required
Type
Description

campaign.id

required

String

the id of the program/campaign the requirement belongs to Note: this campaign/program must belong to your account

id

required

String

the referral program/campaign requirement id

Response

UserRequirementResponse

Field
Type
Description

id

String

the referral program/campaign requirement id

completed

Boolean

a boolean representing if the user has completed the requirement or not

Examples

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.

import { ChainvineClient, getReferrerId } from '@chainvine/sdk';

const userWalletAddress = '0x293kdo0ij0';

const campaignId = 'aSlug123';

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

const requirementId = 'Hiodn2oD2dkmo2';

const userClient = await client.syncUser(userWalletAddress);

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

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.

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.verifyRequirement({
    campaign: {
        id: campaignId
    },
    id: requirementId,
});
PreviousgetUserStats([payload,])NextcompleteRequirement([payload,])

Last updated 1 year ago

⚙️
🧰