Quest Protocol
  • Introduction
    • Welcome to Quest Protocol
    • Integrate & Partner with Quest
    • Use Cases
      • Creator Platforms
      • Gaming
      • NFT Marketplaces
      • Social Media DApps
      • DeFi
  • QUEST PLATFORM
    • Creating a Campaign
    • Audience Overview
    • User Profile
    • Discover Page
    • Perk Store
    • Integrations
    • Memberships
    • Segmentation & Targetting
    • AI Insights
  • QUEST PROTOCOL - SDKs & APIs
    • UI SDK Components
      • Embedded XP Points
      • Embedded in-dApp Guides
      • Embedded Web3 Search
      • Embedded Quests
    • Quest SDKs & APIs
      • User
      • Entity
      • Badge
      • Campaign
      • App Metric
      • Membership Card
      • Entity Tag
      • Membership Tier
      • Skill
      • Entity Credit Tier
      • Gem
      • Custom Reward
      • Entity Gem
      • Entity Alert
      • Entity Feature Flag
      • Entity Data contract
      • Entity Authentication Token
      • Event Metric Mapping
    • Data Engine
  • Website
  • Quest Thesis
Powered by GitBook
On this page
  1. QUEST PROTOCOL - SDKs & APIs
  2. Quest SDKs & APIs

Entity Credit Tier

PreviousSkillNextGem

Last updated 1 year ago

Get credit tiers for an entity

get

This endpoint allows users to retrieve the credit tiers for a specific entity.

Path parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Internal Server Error
application/json
get
GET /api/entities/{entityId}/credits-tiers HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": [
    {
      "entityId": "text",
      "creditsTierId": "text",
      "creditsTierName": "text",
      "price": 1,
      "creditsAmount": 1,
      "recurringTimePeriod": "text",
      "extraCreditsAmount": 1
    }
  ]
}

get Credit tiers

get

This endpoint retrieves credit tiers of an entity.

Path parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/entities/{entityId}/credits HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": {
    "entityId": "abc123",
    "userId": "user1",
    "creditsAmount": 100,
    "history": [
      {
        "creditsAmount": 50,
        "createdAt": "2023-07-21T12:34:56Z",
        "type": "BOUGHT",
        "reason": "Purchase of product XYZ"
      }
    ]
  }
}

Get credit info for a user

get

Retrieve the credit information for a user.

Path parameters
userIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/users/{userId}/credits HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": {
    "entityId": "abc123",
    "userId": "user1",
    "creditsAmount": 100,
    "history": [
      {
        "creditsAmount": 50,
        "createdAt": "2023-07-21T12:34:56Z",
        "type": "BOUGHT",
        "reason": "Purchase of product XYZ"
      }
    ]
  }
}

get Credit tiers for user

get

This endpoint retrieves credit tiers for user of an entity.

Path parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
get
GET /api/entities/{entityId}/user-credits HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Accept: */*
{
  "success": true,
  "data": {
    "entityId": "abc123",
    "userId": "user1",
    "creditsAmount": 100,
    "history": [
      {
        "creditsAmount": 50,
        "createdAt": "2023-07-21T12:34:56Z",
        "type": "BOUGHT",
        "reason": "Purchase of product XYZ"
      }
    ]
  }
}
  • POSTMake payment
  • POSTCreate payment intent for an entity
  • POSTApprove payment for an entity
  • GETGet credit tiers for an entity
  • POSTAdd credit tier for an entity
  • PATCHUpdate credit tier for an entity
  • GETget Credit tiers
  • GETGet credit info for a user
  • POSTBuy credits for a user
  • POSTDecrement credits for a user
  • GETget Credit tiers for user
  • POSTBuy credits for an entity
  • POSTDecrement credits for an entity

Make payment

post

This endpoint allows to make payment.

Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
idstringRequiredExample: stripe-payment-method-id
Responses
200
Successful response
application/json
400
Client error
application/json
500
Server error
application/json
post
POST /api/payment/pay HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 195

{
  "id": "stripe-payment-method-id",
  "product": {
    "price": 100
  },
  "cardData": {
    "email": "[email protected]",
    "name": "Jon Doe",
    "country": "India",
    "zip": 12020
  },
  "info": {
    "userId": "u-1202",
    "entityId": "e-0000000000"
  }
}
{
  "success": true,
  "data": {}
}

Create payment intent for an entity

post

This endpoint allows users to create a payment intent for an entity.

Path parameters
entityIdstringRequired
userIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
forEntityIdstringOptional
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/users/{userId}/create-payment-intent HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 160

{
  "cardData": {
    "email": "[email protected]",
    "name": "text",
    "address": "text"
  },
  "intentData": {
    "paymentMethodId": "text",
    "amount": 1,
    "currency": "text"
  },
  "forEntityId": "text"
}
{
  "success": true,
  "data": {
    "clientSecret": "text",
    "intentId": "text"
  }
}

Approve payment for an entity

post

This endpoint allows users to approve a payment for an entity.

Path parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
intentIdstringRequired

The ID of the payment intent to approve.

Example: pi_123456789
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/approve-payment HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 27

{
  "intentId": "pi_123456789"
}
{
  "success": true
}

Add credit tier for an entity

post

This endpoint allows the entity owner to add a new credit tier.

Path parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
creditsAmountnumberOptional

The amount of credits in the tier.

extraCreditsAmountnumberOptional

The amount of extra bonus credits.

pricenumberOptional

The price of the credit tier.

creditsTierIdstringOptional

The ID of the credit tier.

creditsTierNamestringOptional

The name of the credit tier.

recurringTimePeriodstring · enumOptional

The recurring time period for the credit tier.

Default: ONETIMEPossible values:
Responses
200
Successful response
application/json
400
Client error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/credits-tiers HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 132

{
  "creditsAmount": 1,
  "extraCreditsAmount": 1,
  "price": 1,
  "creditsTierId": "text",
  "creditsTierName": "text",
  "recurringTimePeriod": "ONETIME"
}
{
  "success": true,
  "data": {
    "creditsTierId": "text",
    "creditsTierName": "text"
  }
}

Update credit tier for an entity

patch

This endpoint allows the entity owner to update an existing credit tier.

Path parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
creditsAmountnumberOptional

The updated amount of credits in the tier.

extraCreditsAmountnumberOptional

The updated amount of extra bonus credits.

pricenumberOptional

The updated price of the credit tier.

creditsTierIdstringOptional

The ID of the credit tier to update.

creditsTierNamestringOptional

The updated name of the credit tier.

recurringTimePeriodstring · enumOptional

The updated recurring time period for the credit tier.

Possible values:
Responses
200
Successful response
application/json
400
Client error
application/json
500
Server error
application/json
patch
PATCH /api/entities/{entityId}/credits-tiers HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 132

{
  "creditsAmount": 1,
  "extraCreditsAmount": 1,
  "price": 1,
  "creditsTierId": "text",
  "creditsTierName": "text",
  "recurringTimePeriod": "MONTHLY"
}
{
  "success": true,
  "data": {
    "creditsTierId": "text",
    "creditsTierName": "text",
    "creditsAmount": 1,
    "price": 1,
    "extraCreditsAmount": 1,
    "recurringTimePeriod": "text"
  }
}

Buy credits for a user

post

Purchase credits for a user in a specific entity.

Path parameters
userIdstringRequired
Query parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
creditsTierIdstringOptional
intentIdstringOptional
Responses
200
Successful response
application/json
400
Client error
application/json
401
Unauthorized error
application/json
500
Server error
application/json
post
POST /api/users/{userId}/buy-credits HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 42

{
  "creditsTierId": "text",
  "intentId": "text"
}
{
  "success": true
}

Decrement credits for a user

post

Decrement credits for a user in a specific entity.

Path parameters
userIdstringRequired
Query parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
creditsAmountnumberOptional
Responses
200
Successful response
application/json
400
Client error
application/json
500
Server error
application/json
post
POST /api/users/{userId}/decrement-credits HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 19

{
  "creditsAmount": 1
}
{
  "success": true
}

Buy credits for an entity

post

Buy credits for a user in a specific entity.

Path parameters
entityIdstringRequired
Query parameters
userIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
creditsTierIdstringOptional
intentIdstringOptional
Responses
200
Successful response
application/json
400
Client error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/buy-credits HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 42

{
  "creditsTierId": "text",
  "intentId": "text"
}
{
  "success": true
}

Decrement credits for an entity

post

Decrement credits for a user in a specific entity.

Path parameters
entityIdstringRequired
Header parameters
apikeystringRequired

The API key for authentication

Example: test
apisecretstringOptional

The secret key for authentication

Example: test-secret
useridstringRequired

The Id of the user performing the request.

Example: dummy-userid
tokenstringRequired

The token for user authentication.

Example: dummy-token
Body
userIdstringOptional
creditsAmountnumberOptional
Responses
200
Successful response
application/json
400
Client error
application/json
500
Server error
application/json
post
POST /api/entities/{entityId}/decrement-credits HTTP/1.1
Host: api.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 35

{
  "userId": "text",
  "creditsAmount": 1
}
{
  "success": true
}