đŸ› ī¸
Okapi docs
  • 👋Welcome to Okapi
  • 🧰Our products
  • Fundamentals
    • đŸ› ī¸Quickstart
      • đŸ–ŧī¸Mint new NFT
      • đŸĒ™Mint new tokens
      • 🔑Get API key
      • đŸŽ¯Create an Objective
      • 🎁Create a Reward
      • 🔐Create a token gate
      • đŸ—„ī¸Update your organization profile
      • 🔁Manage subscriptions
      • đŸ”ĸCompute units
      • đŸ’ŗPricing
      • đŸ•šī¸Demo
  • đŸ’ģJS SDK
    • đŸ“ĻInstall Okapi
    • 👀Wallet
    • đŸŽ¯Objective
    • 🎁Reward
    • 🔐Token gating
  • Use case
    • 💡Use case
      • 🎮Gaming
      • 🍔Restaurants
      • đŸ›ī¸Retailers
      • âœˆī¸Travel
      • 🏨Hospitality
      • đŸĻFinancial services
Powered by GitBook
On this page
  1. JS SDK

Objective

Objective transaction for FIXED amount

PreviousWalletNextReward

Last updated 2 years ago

This endpoint will send a number of Tokens or NFTs determined by the objective that you've created on your .

In this example, a we have created a Signup objective. When a user sign up to the app, we want to send him a 100 Okapi coins . To do so, we need to use the objective endpoint. You can think of the objective endpoint as an endpoint that sends Tokens or NFTs to a user when he completes an objective.

To see how to create an objective on Okapi, see the Create an objective section.

Note: You don't have to create a user wallet before sending him tokens. We will create a new one if the user did not exists.

This endpoint takes an id (objective ID) and a user (unique identifier).

const data = await okApiClient.objective({ id: "OBJECTIVE_ID", user: "john@doe.com" })
{
    "txSignature": "5oMDLE2uLfFJVXSB3mqa4m9wwSquENEjzpGDUWeC55VsCcekex6hsAAsQdVE4z2PUSkQCS8EXjMjFUFieJDs1fQX",
    "success": true
}
{
    "message": "Forbidden"
}

If the objective ID exists and the transaction is successful, your user (john@doe.com) will now have 100 Okapi coin in it's wallet. You will get a success boolean and a txSignature .

Cost: 10 compute units

Note: The documentation for objective transaction for DYNAMIC amount is coming soon.

You can take a look at the transaction here to see that the user has received the 100 Okapi coins and that your account has been debited of the same amount.

đŸ’ģ
đŸŽ¯
https://explorer.solana.com/tx/5oMDLE2uLfFJVXSB3mqa4m9wwSquENEjzpGDUWeC55VsCcekex6hsAAsQdVE4z2PUSkQCS8EXjMjFUFieJDs1fQX
Okapi dashboard