# API “Invalid msg.value” error when swapping bnb for another token

**URL:** https://gov.1inch.network/t/api-invalid-msg-value-error-when-swapping-bnb-for-another-token/349
**Category:** 3.0 Developer Portal
**Created:** [March 1, 2022, 5:26am UTC](https://gov.1inch.network/t/api-invalid-msg-value-error-when-swapping-bnb-for-another-token/349 "2022-03-01T05:26:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jwproton5454](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jwproton5454](https://gov.1inch.network/u/jwproton5454)
#### Post date: [March 1, 2022, 5:26am UTC](https://gov.1inch.network/t/api-invalid-msg-value-error-when-swapping-bnb-for-another-token/349/1 "2022-03-01T05:26:11Z")

</div>

Hi, I am using the api to do a swap. When I try swapping DAI for BNB on Binance Smart Chain, it goes through.

 ![](https://global.discourse-cdn.com/standard11/uploads/x1inch/original/1X/1723a9cfdcf0f6e26f5f2b59ac5a247a66d54573.png)

```
  <a href="https://bscscan.com/tx/0x42339a02242644edfa3f530973cb807228254b760e3d950c3a5be5590d4e2b18" target="_blank" rel="noopener nofollow ugc">Binance (BNB) Blockchain Explorer</a>

```

 ![](https://BscScan.com/images/brandassets/BscScan-logo-circle.jpg)
### [Binance Transaction Hash (Txhash) Details | BscScan](https://bscscan.com/tx/0x42339a02242644edfa3f530973cb807228254b760e3d950c3a5be5590d4e2b18)

Binance (BNB) detailed transaction info for txhash 0x42339a02242644edfa3f530973cb807228254b760e3d950c3a5be5590d4e2b18. The transaction status, block confirmation, gas fee, BNB, and token transfer are shown.

However, when I try to swap BNB for DAI or for USDC or for CAKE, I am getting “Invalid msg.value” error. I do have enough BNB and using the same gas settings as for the successful transaction above.  
Here are failed transactions:  
0x231ad53ea298672d842a413c63fa5da5de7f83a204dae0f2608f3884262aa144  
0x4a71c27e365e738d82368b21d5e8e570329627a4b8cc3ed41f2c7e8eb1b22949  
0x9e5279e1c98613ef8f57002dbaa8785fe2a721ddec8639ed4bfb6890ec942d15

Thank you!

---

<div class="post-metadata">

### Author: ![Belac](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@Belac](https://gov.1inch.network/u/Belac)
#### Post date: [March 1, 2022, 8:41pm UTC](https://gov.1inch.network/t/api-invalid-msg-value-error-when-swapping-bnb-for-another-token/349/2 "2022-03-01T20:41:52Z")

</div>

Hi,

You may need to make sure your msg.value is being create as a Big Number. JavaScript (or python) may have rounding issues causing this invalid msg.value error.

---

<div class="post-metadata">

### Author: ![Belac](https://avatars.discourse-cdn.com/v4/letter/b/e19b73/32.png) [@Belac](https://gov.1inch.network/u/Belac)
#### Post date: [March 1, 2022, 8:42pm UTC](https://gov.1inch.network/t/api-invalid-msg-value-error-when-swapping-bnb-for-another-token/349/3 "2022-03-01T20:42:10Z")

</div>



---

<div class="post-metadata">

### Author: ![jwproton5454](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jwproton5454](https://gov.1inch.network/u/jwproton5454)
#### Post date: [March 1, 2022, 10:48pm UTC](https://gov.1inch.network/t/api-invalid-msg-value-error-when-swapping-bnb-for-another-token/349/4 "2022-03-01T22:48:41Z")

</div>

Thanks for the reply. I think it is but let me doublecheck, I am using Nethereum when sending transaction.
