Skip to main content

Shop

Shop

The shop module facilitates purchasing of items within a gaming system. Shop items are curated and managed through administrative tools or development environments. These items are then accessible to gamers within the game environment, where they can purchase, use, and interact with them as part of their gaming experience.

This module ensures seamless transaction and management of in-game assets, enhancing overall gameplay for players.

info

Base Endpoint: /api/v1

Available Endpoints

1. Get Own List of Inventory Items

  • Method & Path: GET /:applicationId/shop
  • Description: Allows gamer to browse and view items available for purchase within the game. These items are curated and configured by administrators or developers using administrative tools or development environments.
  • Headers:
    • Authorization: Bearer token for user authentication.
  • Query Parameters:
    • applicationId: Unique Identifier of application.
  • Response Body: An array of shop item each containing:
    • id: Unique identifier of the shop item.
    • shopCategoryId: Identifier of the category to which the shop item belongs.
    • name: Name of the shop item.
    • thumbnail: Object containing details about the thumbnail image of the shop item.
      • id: Unique identifier of the thumbnail.
      • name: Name of the thumbnail.
      • description: Description of the thumbnail.
      • uri: URI pointing to the thumbnail image.
    • isIAP: Boolean indicating if the item is available for in-app purchase (IAP).
    • price: Price of the shop item (0 if it's free or not for sale).
    • productId: Identifier of the product associated with the shop item (if applicable).
    • receiveItem: Array of objects detailing items received upon purchasing this shop item.
      • id: Unique identifier of the receive item.
      • itemId: Identifier of the item received.
      • quantity: Quantity of the item received.
      • shopItemId: Identifier of the shop item related to this receive item.
    • spendItem: Array of objects detailing items required to purchase this shop item.
      • id: Unique identifier of the spend item.
      • itemId: Identifier of the item required.
      • quantity: Quantity of the item required.
      • shopItemId: Identifier of the shop item related to this spend item.

cURL Command

curl --request GET \
--url https://api.yarsaplay.com/api/v1/__APPLICATIONID__/shop

Response Body

[
{
"id": "<uuid>",
"isIAP": "<boolean>",
"name": "<string>",
"price": "<number>",
"productId": "<string,null>",
"receiveItem": [
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
},
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
}
],
"shopCategoryId": "<uuid>",
"spendItem": [
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
},
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
}
],
"thumbnail": {
"description": "<string,null>",
"id": "<uuid>",
"name": "<string>",
"uri": "<uri>"
}
},
{
"id": "<uuid>",
"isIAP": "<boolean>",
"name": "<string>",
"price": "<number>",
"productId": "<string,null>",
"receiveItem": [
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
},
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
}
],
"shopCategoryId": "<uuid>",
"spendItem": [
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
},
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
}
],
"thumbnail": {
"description": "<string,null>",
"id": "<uuid>",
"name": "<string>",
"uri": "<uri>"
}
}
]

2. Purchase Shop Item

This endpoint enables gamers to retrieve a list of items available for purchase in the shop.

  • Method & Path: POST /:shopItemId/purchase
  • Description: Facilitates the purchase of a specific item from the shop. Gamers use this endpoint to acquire items for use within the game.
  • Headers:
    • Authorization: Bearer token for user authentication.
  • Query Parameters:
    • shopItemId: Unique identifier of shopItemId.
  • Response Body: shop purchased item each containing
    • id: Unique identifier of the item relationship.
    • itemId: Identifier of the specific item.
    • quantity: Quantity associated with the item.
    • shopItemId: Identifier linking the item to a specific shop item.

cURL Command

curl --request POST \
--url https://api.yarsaplay.com/api/v1/__SHOPITEMID__/purchase \
--header 'Authorization: Bearer YOUR_SECRET_TOKEN'

Response Body

[
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
},
{
"id": "<uuid>",
"itemId": "<uuid>",
"quantity": "<number>",
"shopItemId": "<uuid>"
}
]