Redeeming codes
You can redeem codes in two ways:
- From the database: The API pulls a code from the database and redeems it for you. The database syncs with the bot, so you or your users can add codes there without worrying about storage.
- Directly: You provide the code with each request. This gives you full control over your codes, but adds complexity when errors occur since you need to decide what to do with failed codes.
Let’s start with the database method since it’s simpler. We’ll cover direct redemption afterward.
Making the request
Use the POST /redeem endpoint to redeem a code.
Here’s how:
Let’s break down the key parameters:
requireReceipt
This parameter used to control whether you would get an email/password when redeeming.
Right now, this parameter affects nothing and should be left as true.
It is kept only for backwards compatibility.
playerId
This is the player’s in-game character ID (a string of digits).
Use the GET /character endpoint to verify the player ID first.
It returns the player’s name, which helps users confirm they entered the right ID.
gameId
Currently, our service supports redeeming codes for 3 games:
- PUBG Mobile (
pubg_mobile) - Honor of Kings (
honor_of_kings) - Garena Free Fire (
free_fire)
The API interface is basically identical, and you can switch between games easily.
The database is separate for each game. That means that you can redeem only with
codeOverride for all games except pubg_mobile.
Support for managing databases for other games will be released soon.
Understanding the response
When redemption succeeds, you’ll get an ActivationReceipt object:
Here’s what each field means:
ID
Each receipt has a unique ID.
You can retrieve it later with GET /history/{id}, or use the /receipt_{id} command in the bot to view it.
Email and password
You’ll get the Midasbuy account credentials used for redemption. You can use these to log in and verify the transaction yourself. It’s usually safe to share these with users, but remember that one account may have multiple redemptions.
If you can’t log in to the account, contact support to reset the password.
For Gaerna games (Free Fire), email is an internal player account ID, and password is
the session token used for the activation.
Warning
After redemption, we check if a “full receipt” appears on the account.
To see the receipt yourself: log into Midasbuy, click your account, then “Order Center”. Each item there is a “full receipt”.
For Garena games, warning should always be false.
The warning field is true when We can’t find the full receipt for some reason.
This happens rarely, but is still possible in some cases (usually network issues on the game provider or our side).
Amount
This shows how much UC/Diamonds/currency were redeemed. This field might not be present in some cases when we’re not able to detect the amount definitively.
Handling errors
We’ll cover all errors in detail later, but here are the basics.
When redemption fails, you’ll get an ActivationErrorResponse containing an ActivationError object with errorCode.
errorCode is a specific error type from a fixed set of options.
For example, CHARACTER_NOT_FOUND means the playerId is invalid or the player lookup failed.
See the Error handling guide for more information.
Direct redemption
If you prefer not to use the database, you can provide codes directly with each request.
Send a RedeemCodeDirectRequest instead of a RedeemCodeFromDbRequest.
(In the HTTP API, omit denomination and use codeOverride instead.)
Next steps
Learn about all possible errors and how to handle them.