Skip to main content

Webhooks

Receive real-time notifications using webhooks

Webhooks are used to notify you about item changes and transactions.

The following webhook types are available:

  • Item Changed
  • Premium Currency Transactions
  • Token Transactions

Create webhook

Please contact your Open Loot representative to begin the process of creating a webhook for receiving events from your game. You will be expected to provide the following information:

  • name: Webhook Name
  • target: URL endpoint where to receive the events. This URL should be https.
  • events: List of events you want to receive in this webhook. Avaliable event: premium-currencies-transactions, tokens-transactions and item-changed
  • secret: Secret key for signing the events with SHA256.

Events

Premium currency transaction

This event is emitted whenever a premium currency transaction occurs.

{
"id": "6ad84183-7f95-40c5-80a2-d698f8c734e4",
"type": "premium-currencies-transactions",
"message": {
"transactionId": "b4328900-041a-4b4e-8770-cac20ec4a320",
"premiumCurrencyId": "32b20375-c94f-4c6e-9ce1-e1b604b5208d",
"userId": "bd68ffa9-6761-4405-98c2-a30c9ed1196d",
"action": "grant",
"amount": 2,
"updatedBalance": 20,
"time": "2024-04-16T14:39:08.585Z",
"source": "game"
},
"timestamp": "2024-04-16T14:39:08.632Z",
"signature": "ab767299f3c883e411f77ec9cd1fcae08e5c11a11280b9c6cef4a48fc077bbe2"
}
  • type: Event type
  • transactionId: Unique identifier for the transaction
  • premiumCurrencyId: Unique identifier for the premium currency
  • userId: Unique identifier for the user involved in the transaction
  • action: Transaction action. Could be "grant" or "deduct".
  • amount: Currency amount involved in the transaction
  • updatedBalance The new balance amount
  • time: Time when the transaction was generated
  • source: Transacount source that generated the event. Could be: craft, reroll, game, api, airdrop, external_package_sale, external_package_refund, stack_sale, redeem, package_sale, campaign, conversion or expiration

Token transaction

This event is emited when a token transaction occurs.

{
"id": "526a1608-9a5f-45d5-b6d4-0b357e7c56c1",
"type": "tokens-transactions",
"message": {
"transactionId": "ed53e73f-e220-413d-b159-887b3d50f8a0",
"tokenId": "a07b874f-d30a-41d5-bfb1-879abf474590",
"userId": "83619611-c963-4de0-b482-79ee7e978c1f",
"action": "deduct",
"amount": 3,
"updatedBalance": 21,
"time": "2024-04-16T14:44:23.571Z",
"source": "in-game"
},
"timestamp": "2024-04-16T14:44:23.605Z",
"signature": "69cc8cc43fa94088b7467b013fc9daa0d3022ea33b17f1bc47d99fa22d18b03f"
}
  • type: Event type
  • transactionId: Unique identifier for the transaction
  • tokenId: Unique identifier for the token
  • userId: Unique identifier for the user involved in the transaction
  • action: Transaction action. Could be "grant", "deduct", "deposit" or "withdraw".
  • amount: Token amount involved in the transaction
  • updatedBalance: The new balance amount
  • time: Time when the transaction was generated
  • source: Transacount source that generated the event. Could be: in-game, deposit, withdraw, craft, mystery_box, gamedrop, airdrop, swap, conversion, primary, secondary, game_settlement, game_withdraw or refund

Item changed

This event is emitted every time the owner or the status of an item changed.

{
"id": "408bbb65-8bba-43c8-b696-6f9121f7b2fa",
"type": "item-changed",
"message": {
"itemId": "6b6d6a24-c5bd-4468-9f80-49dbd0d13709",
"oldStatus": "in-game",
"newStatus": "unlocked",
"oldUserId": "9e8afbfb-332c-4a9c-bfb7-180234d1dcf0",
"newUserId": "9e8afbfb-332c-4a9c-bfb7-180234d1dcf0",
"changedAttributes": false,
"rentedBy": null,
"version": 20
},
"timestamp": "2024-04-16T14:44:09.231Z",
"signature": "01760f6b0859669408d88bcc55a27aa03b3841b16033a5cb43f2fb162c5ecb95"
}
  • type: Event type
  • itemId: Unique identifier for the item
  • oldStatus: Status before item change.
  • newStatus: Status after item change. If same value as oldStatus is because the item change doesn't affect the status.
  • oldUserId: Owner before item change.
  • newUserId: Owner after item change. If same value as oldUserId is because the item change doesn't affect the userId.
  • changedAttributes: This field notify if the attributes were changed.
  • rentedBy: This field identify if the item is being rented or not. If value present represents the userId of the renter.
  • version: Incremental counter of entity changes.

Security

All the events are signed with SHA256 using the provided secret in the webhook. In your side you must validate the signature field using the field message in the event.

Integration

All events should be responded to with an HTTP status 200 code to notify the webhook service that the event was processed successfully on the destination. Any other response code will be retry sending the event again.