Fetching and Opening Loot Boxes for a Program Membership
Loot boxes are collections of virtual items or rewards that a user can obtain within a program.
How Loot Boxes Work in Hang
A loot box for a program represents a set of virtual items or rewards that can be obtained by a user. Hang's Partner API lets you fetch all allocated loot boxes for a particular program membership as well as open any loot box to reveal its contents.
Fetching All Allocated Loot Boxes for a Program Membership
Fetching all loot boxes for a specific program membership is as straightforward as making a GET
request to the /v2/program-memberships/:program_membership_id/loot-boxes
endpoint.
Request Parameters
program_membership_id
(required): The ID of the user's program membership.
Example Request
Here's an example of a valid GET request to fetch all allocated loot boxes for a program membership:
Response
If successful, the API will return a 200 OK
status along with a JSON object containing information about all the allocated loot boxes.
Example Response
Opening a Loot Box
To open a loot box, make a POST
request to the /v2/program-memberships/:program_membership_id/loot-boxes/:loot_box_id/open
endpoint.
Request Parameters
program_membership_id
(required): The ID of the user's program membership.loot_box_id
(required): The ID of the loot box to be opened.
Example Request
Here's an example of a valid POST request to open a loot box:
Response
If successful, the API will return a 200 OK
status along with a JSON object containing information about the reward obtained from the loot box.
Example Response
Error Handling
In case of an error, the API will return a specific error code and message. Refer to the API documentation for details on how to handle different types of errors.
Last updated