Skip to main content

Redeem a Binance Gift Card(USER_DATA)

API Description

This API is for redeeming a Binance Gift Card Once redeemed, the coins will be deposited in your funding wallet.

HTTP Request

POST /sapi/v1/giftcard/redeemCode

Please note that if you enter the wrong redemption code 5 times within 24 hours, you will no longer be able to redeem any Binance Gift Cards that day

Request Weight(IP)

1

Request Parameters

NameTypeMandatoryDescription
codeSTRINGYESRedemption code of Binance Gift Card to be redeemed, supports both Plaintext & Encrypted code.
externalUidSTRINGNOEach external unique ID represents a unique user on the partner platform. The function helps you to identify the redemption behavior of different users, such as redemption frequency and amount. It also helps risk and limit control of a single account, such as daily limit on redemption volume, frequency, and incorrect number of entries. This will also prevent a single user account reach the partner's daily redemption limits. We strongly recommend you to use this feature and transfer us the User ID of your users if you have different users redeeming Binance Gift Cards on your platform. To protect user data privacy, you may choose to transfer the user id in any desired format (max. 400 characters).
recvWindowLONGNO
timestampLONGYES
  • Parameter code can be sent in two formats:
    • Plaintext
    • Encrypted
  • Sending code in Encrypted format provides more security than sending it as a plaintext. To send card code in encrypted format the following steps must be followed:
    • Fetch RSA public key from api stated below.
    • Use the below algorithm to encrypt the card code using the RSA public key fetched above: RSA/ECB/OAEPWithSHA-256AndMGF1Padding

A sample code snippet (JAVA) is stated below for reference, the same approach can be used for different languages like C#, PERL, PYTHON, SHELL etc.:

  private static PublicKey getPublicKey(String publicKey) throws Exception {
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
byte[] decodedKey = Base64.decodeBase64(publicKey.getBytes());
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(decodedKey);
return keyFactory.generatePublic(keySpec);
}

public static String encrypt(String content, String publicKeyString) throws Exception {
if (StringUtils.isAnyEmpty(new CharSequence[]{content, publicKeyString})) {
throw new IllegalArgumentException("invalid content or privateKey.");
} else {
Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWITHSHA-256ANDMGF1PADDING", "BC");
cipher.init(Cipher.ENCRYPT_MODE, getPublicKey(publicKeyString));
return new String(Base64.encodeBase64URLSafe(cipher.doFinal(content.getBytes("UTF-8"))));
}
}

static {
Security.addProvider(new BouncyCastleProvider());
}

Response Example

{
"code":"000000",
"message":"success",
"data":{
"referenceNo":"0033002328060227",
"identityNo":"10317392647411060736",
"token":"BNB",
"amount":"0.00000001"
},
"success":true
}