Entity Credit Tier

Make payment

post
/payment/pay

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
post
/payment/pay
POST /api/payment/pay HTTP/1.1
Host: https:/.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
/entities/{entityId}/users/{userId}/create-payment-intent

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
post
/entities/{entityId}/users/{userId}/create-payment-intent
POST /api/entities/{entityId}/users/{userId}/create-payment-intent HTTP/1.1
Host: https:/.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
/entities/{entityId}/approve-payment

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
post
/entities/{entityId}/approve-payment
POST /api/entities/{entityId}/approve-payment HTTP/1.1
Host: https:/.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 27

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

Get credit tiers for an entity

get
/entities/{entityId}/credits-tiers

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
get
/entities/{entityId}/credits-tiers
GET /api/entities/{entityId}/credits-tiers HTTP/1.1
Host: https:/.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
    }
  ]
}

Add credit tier for an entity

post
/entities/{entityId}/credits-tiers

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
post
/entities/{entityId}/credits-tiers
POST /api/entities/{entityId}/credits-tiers HTTP/1.1
Host: https:/.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
/entities/{entityId}/credits-tiers

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
patch
/entities/{entityId}/credits-tiers
PATCH /api/entities/{entityId}/credits-tiers HTTP/1.1
Host: https:/.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"
  }
}

get Credit tiers

get
/entities/{entityId}/credits

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
get
/entities/{entityId}/credits
GET /api/entities/{entityId}/credits HTTP/1.1
Host: https:/.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
/users/{userId}/credits

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
get
/users/{userId}/credits
GET /api/users/{userId}/credits HTTP/1.1
Host: https:/.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"
      }
    ]
  }
}

Buy credits for a user

post
/users/{userId}/buy-credits

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
post
/users/{userId}/buy-credits
POST /api/users/{userId}/buy-credits?entityId=text HTTP/1.1
Host: https:/.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
/users/{userId}/decrement-credits

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
post
/users/{userId}/decrement-credits
POST /api/users/{userId}/decrement-credits?entityId=text HTTP/1.1
Host: https:/.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 19

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

get Credit tiers for user

get
/entities/{entityId}/user-credits

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
get
/entities/{entityId}/user-credits
GET /api/entities/{entityId}/user-credits HTTP/1.1
Host: https:/.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"
      }
    ]
  }
}

Buy credits for an entity

post
/entities/{entityId}/buy-credits

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
post
/entities/{entityId}/buy-credits
POST /api/entities/{entityId}/buy-credits?userId=text HTTP/1.1
Host: https:/.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
/entities/{entityId}/decrement-credits

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
post
/entities/{entityId}/decrement-credits
POST /api/entities/{entityId}/decrement-credits HTTP/1.1
Host: https:/.questprotocol.xyz
apikey: test
userid: dummy-userid
token: dummy-token
Content-Type: application/json
Accept: */*
Content-Length: 35

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

Last updated