Skip to main content

Developer API (2.0.0)

Download OpenAPI specification:Download

Virtual Currency

Operations about virtual currencies.

Get a list of virtual currencies

This endpoint requires the following permission(s): project_configuration:virtual_currencies:read. This endpoint belongs to the Project Configuration domain, which has a default rate limit of 60 requests per minute.

Authorizations:
BearerAuth
path Parameters
project_id
required
string <= 255 characters
Example: proj1ab2c3d4

ID of the project

query Parameters
starting_after
string
Example: starting_after=ent12354

Pagination cursor. Pass the id of the last item from the previous page to fetch the next page; omit for the first page.

limit
integer
Default: 20
Example: limit=10

Maximum number of items to return per page. Values below 1 or above 100 are clamped to that range rather than rejected.

Responses

Response samples

Content type
application/json
{
  • "object": "list",
  • "items": [
    ],
  • "next_page": "/v2/projects/proj1ab2c3d4/virtual_currencies?starting_after=GLD",
  • "url": "/v2/projects/proj1ab2c3d4/virtual_currencies"
}

Create a virtual currency

This endpoint requires the following permission(s): project_configuration:virtual_currencies:read_write. This endpoint belongs to the Project Configuration domain, which has a default rate limit of 60 requests per minute.

Authorizations:
BearerAuth
path Parameters
project_id
required
string <= 255 characters
Example: proj1ab2c3d4

ID of the project

Request Body schema: application/json
required
code
required
string [ 1 .. 10 ] characters ^[a-zA-Z0-9_]+$

The unique code for this virtual currency

name
required
string [ 1 .. 50 ] characters

The display name of the virtual currency

description
string or null [ 1 .. 1500 ] characters

Description of the virtual currency

Array of objects or null (VirtualCurrencyProductGrantInput)

Product grants that define how products grant this virtual currency

Array
product_ids
required
Array of strings non-empty [ items [ 1 .. 255 ] characters ]

The list of product IDs that grant this virtual currency

amount
required
integer >= 1

The amount of virtual currency granted

trial_amount
integer or null >= 0

The amount of virtual currency granted during trial period

expire_at_cycle_end
boolean or null

Whether the grant expires at the end of the subscription cycle

Responses

Request samples

Content type
application/json
{
  • "code": "GLD",
  • "name": "Gold",
  • "description": "Gold currency used in the game",
  • "product_grants": [
    ]
}

Response samples

Content type
application/json
{
  • "state": "active",
  • "object": "virtual_currency",
  • "project_id": "proj1ab2c3d4",
  • "code": "GLD",
  • "name": "Gold",
  • "created_at": 1658399423658,
  • "description": "Gold currency used in the game",
  • "product_grants": [
    ]
}

Get a virtual currency

This endpoint requires the following permission(s): project_configuration:virtual_currencies:read. This endpoint belongs to the Project Configuration domain, which has a default rate limit of 60 requests per minute.

Authorizations:
BearerAuth
path Parameters
project_id
required
string <= 255 characters
Example: proj1ab2c3d4

ID of the project

virtual_currency_code
required
string [ 1 .. 10 ] characters ^[a-zA-Z0-9_]+$

The virtual currency code

Responses

Response samples

Content type
application/json
{
  • "state": "active",
  • "object": "virtual_currency",
  • "project_id": "proj1ab2c3d4",
  • "code": "GLD",
  • "name": "Gold",
  • "created_at": 1658399423658,
  • "description": "Gold currency used in the game",
  • "product_grants": [
    ]
}

Update a virtual currency

This endpoint requires the following permission(s): project_configuration:virtual_currencies:read_write. This endpoint belongs to the Project Configuration domain, which has a default rate limit of 60 requests per minute.

Authorizations:
BearerAuth
path Parameters
project_id
required
string <= 255 characters
Example: proj1ab2c3d4

ID of the project

virtual_currency_code
required
string [ 1 .. 10 ] characters ^[a-zA-Z0-9_]+$

The virtual currency code

Request Body schema: application/json
required
name
string [ 1 .. 50 ] characters

The display name of the virtual currency

description
string or null [ 1 .. 1500 ] characters

Description of the virtual currency

Array of objects or null (VirtualCurrencyProductGrantInput)

Product grants that define how products grant this virtual currency

Array
product_ids
required
Array of strings non-empty [ items [ 1 .. 255 ] characters ]

The list of product IDs that grant this virtual currency

amount
required
integer >= 1

The amount of virtual currency granted

trial_amount
integer or null >= 0

The amount of virtual currency granted during trial period

expire_at_cycle_end
boolean or null

Whether the grant expires at the end of the subscription cycle

Responses

Request samples

Content type
application/json
{
  • "name": "Gold",
  • "description": "Gold currency used in the game",
  • "product_grants": [
    ]
}

Response samples

Content type
application/json
{
  • "state": "active",
  • "object": "virtual_currency",
  • "project_id": "proj1ab2c3d4",
  • "code": "GLD",
  • "name": "Gold",
  • "created_at": 1658399423658,
  • "description": "Gold currency used in the game",
  • "product_grants": [
    ]
}

Delete a virtual currency

This endpoint requires the following permission(s): project_configuration:virtual_currencies:read_write. This endpoint belongs to the Project Configuration domain, which has a default rate limit of 60 requests per minute.

Authorizations:
BearerAuth
path Parameters
project_id
required
string <= 255 characters
Example: proj1ab2c3d4

ID of the project

virtual_currency_code
required
string [ 1 .. 10 ] characters ^[a-zA-Z0-9_]+$

The virtual currency code

Responses

Response samples

Content type
application/json
{
  • "object": "app",
  • "id": "string",
  • "deleted_at": 1658399423658
}

Archive a virtual currency

Archives a virtual currency (makes it inactive). This endpoint requires the following permission(s): project_configuration:virtual_currencies:read_write. This endpoint belongs to the Project Configuration domain, which has a default rate limit of 60 requests per minute.

Authorizations:
BearerAuth
path Parameters
project_id
required
string <= 255 characters
Example: proj1ab2c3d4

ID of the project

virtual_currency_code
required
string [ 1 .. 10 ] characters ^[a-zA-Z0-9_]+$

The virtual currency code

Responses

Response samples

Content type
application/json
{
  • "state": "active",
  • "object": "virtual_currency",
  • "project_id": "proj1ab2c3d4",
  • "code": "GLD",
  • "name": "Gold",
  • "created_at": 1658399423658,
  • "description": "Gold currency used in the game",
  • "product_grants": [
    ]
}

Unarchive a virtual currency

Unarchives a virtual currency (makes it active). This endpoint requires the following permission(s): project_configuration:virtual_currencies:read_write. This endpoint belongs to the Project Configuration domain, which has a default rate limit of 60 requests per minute.

Authorizations:
BearerAuth
path Parameters
project_id
required
string <= 255 characters
Example: proj1ab2c3d4

ID of the project

virtual_currency_code
required
string [ 1 .. 10 ] characters ^[a-zA-Z0-9_]+$

The virtual currency code

Responses

Response samples

Content type
application/json
{
  • "state": "active",
  • "object": "virtual_currency",
  • "project_id": "proj1ab2c3d4",
  • "code": "GLD",
  • "name": "Gold",
  • "created_at": 1658399423658,
  • "description": "Gold currency used in the game",
  • "product_grants": [
    ]
}