diff --git a/CHANGELOG.md b/CHANGELOG.md
index 20e1d81..b62827d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog
+## 3.4.2 - 2024-09-24
+### Added
+- Add GiftCard endpoint:
+ - `POST /sapi/v1/giftcard/buyCode` to create a dual-token gift card
+
## 3.4.1 - 2024-08-19
### Updated
- Updated dependencies
diff --git a/__tests__/spot/gift_card/giftCardBuyCode.test.js b/__tests__/spot/gift_card/giftCardBuyCode.test.js
new file mode 100644
index 0000000..3f1bc86
--- /dev/null
+++ b/__tests__/spot/gift_card/giftCardBuyCode.test.js
@@ -0,0 +1,33 @@
+/* global describe, it, expect */
+const MissingParameterError = require('../../../src/error/missingParameterError')
+const { nockPostMock, buildQueryString, SpotClient } = require('../../testUtils/testSetup')
+
+const {
+ mockResponse,
+ amount
+} = require('../../testUtils/mockData')
+
+const baseToken = 'USDT'
+const faceToken = 'BNB'
+
+describe('#giftCardBuyCode', () => {
+ it.each([
+ [undefined, undefined, undefined], ['', '', ''], [null, null, null],
+ [undefined, faceToken, undefined], ['', faceToken, ''], [null, faceToken, null],
+ [baseToken, undefined, undefined], [baseToken, '', ''], [baseToken, null, null],
+ [undefined, undefined, amount], ['', '', amount], [baseToken, faceToken, null]
+ ])('should throw MissingParameterError given missing params', (baseToken, faceToken, amount) => {
+ expect(() => {
+ SpotClient.giftCardBuyCode(baseToken, faceToken, amount)
+ }).toThrow(MissingParameterError)
+ })
+
+ it('should return binance code info', () => {
+ nockPostMock(`/sapi/v1/giftcard/buyCode?${buildQueryString({ baseToken, faceToken, baseTokenAmount: amount })}`)(mockResponse)
+
+ return SpotClient.giftCardBuyCode(baseToken, faceToken, amount).then(response => {
+ expect(response).toBeDefined()
+ expect(response.data).toEqual(mockResponse)
+ })
+ })
+})
diff --git a/examples/spot/gift_card/giftCardBuyCode.js b/examples/spot/gift_card/giftCardBuyCode.js
new file mode 100644
index 0000000..d98610d
--- /dev/null
+++ b/examples/spot/gift_card/giftCardBuyCode.js
@@ -0,0 +1,10 @@
+'use strict'
+
+const Spot = require('../../../src/spot')
+
+const apiKey = ''
+const apiSecret = ''
+const client = new Spot(apiKey, apiSecret)
+
+client.giftCardBuyCode('BUSD', 'BNB', 10).then(response => client.logger.log(response.data))
+ .catch(error => client.logger.error(error))
diff --git a/src/modules/restful/giftCard.js b/src/modules/restful/giftCard.js
index 7a941e3..0c06c88 100644
--- a/src/modules/restful/giftCard.js
+++ b/src/modules/restful/giftCard.js
@@ -30,6 +30,30 @@ const GiftCard = superclass => class extends superclass {
)
}
+ /**
+ * Create a dual-token gift card (fixed value, discount feature) (TRADE)
+ *
+ * POST /sapi/v1/giftcard/buyCode
+ *
+ * {@link https://binance-docs.github.io/apidocs/spot/en/#create-a-dual-token-gift-card-fixed-value-discount-feature-trade}
+ *
+ * @param {baseToken} baseToken - The token you want to pay, example: BUSD
+ * @param {faceToken} faceToken - The token you want to buy, example: BNB. If faceToken = baseToken, it's the same as createCode endpoint.
+ * @param {baseTokenAmount} amount - The base token asset quantity
+ * @param {discount} discount - Stablecoin-denominated card discount percentage
+ * @param {object} [options]
+ * @param {number} [options.recvWindow] - The value cannot be greater than 60000
+ */
+ giftCardBuyCode (baseToken, faceToken, baseTokenAmount, discount, options = {}) {
+ validateRequiredParameters({ baseToken, faceToken, baseTokenAmount })
+
+ return this.signRequest(
+ 'POST',
+ '/sapi/v1/giftcard/buyCode',
+ Object.assign(options, { baseToken, faceToken, baseTokenAmount, discount })
+ )
+ }
+
/**
* Redeem a Binance Code (USER_DATA)
*