> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Funding

> The React SDK opened funding, on-ramp, and exchange screens from hooks like useFundWithWallet and useOnramp. In the JavaScript SDK each funding path is a function (and hook), and you build the menu that routes between them.

The React SDK bundled funding behind a set of hooks (`useFundWithWallet`, `useOnramp`, `useExchangeAccounts`, `useOpenFundingOptions`, `usePayWithDynamic`) that opened the widget's funding modals. The JavaScript SDK exposes each funding path — wallet transfer, on-ramp providers, and exchange transfers — as its own function (with a matching React hook), and leaves the "how do you want to add funds?" menu to you.

The on-ramp provider surfaces (MoonPay, Coinbase) are the same build in any JavaScript SDK app: [**Funding flows** (Building UI)](https://docs.dynamic.xyz/docs/javascript/building-ui/funding-flows.md) covers them with full code. This page is the React→JavaScript translation across every funding path plus what the widget's funding menu did for you.

## Transfer from a connected wallet

| React SDK | JavaScript SDK |
| - | - |
| `useFundWithWallet()` | `transferAmount()` / `useTransferAmount()` |

`transferAmount()` sends native currency or a token from a specific `walletAccount` (from `getWalletAccounts()`) to a recipient and resolves with the `transactionHash`. Omit `token` for the native asset; for an ERC-20 include its `{ address, decimals }`.

## On-ramps (buy crypto)

`useOnramp` becomes one function per provider — build the URL (or order), open it, then reconcile the result in your UI. The MoonPay and Coinbase surfaces are built in [Funding flows (Building UI)](https://docs.dynamic.xyz/docs/javascript/building-ui/funding-flows.md).

| React SDK (`useOnramp`) | JavaScript SDK |
| - | - |
| MoonPay | `getMoonPayUrl()` / `useGetMoonPayUrl()`, `getMoonPayCurrencies()` |
| Coinbase | `getCoinbaseBuyUrl()`, `createCoinbaseOnrampOrder()`, `addCoinbaseOnrampOrderEventListener()` |
| Crypto.com | `createCryptoDotComPayment()` / `useCreateCryptoDotComPayment()` |

For Coinbase, `createCoinbaseOnrampOrder()` starts an order and `addCoinbaseOnrampOrderEventListener()` reports its progress; `getMissingVerificationForCoinbaseOnrampOrder()` tells you what identity step (if any) the user still needs.

## Exchange transfers

`useExchangeAccounts` becomes one set of functions per exchange: read the user's accounts, resolve where funds can go, and start a transfer.

**Kraken.** See the [Kraken integration reference](https://docs.dynamic.xyz/docs/javascript/funding/kraken-integration.md) for each function's parameters and return shape.

| React SDK | JavaScript SDK |
| - | - |
| `useExchangeAccounts()` | `getKrakenAccounts()` / `useGetKrakenAccounts()` |
| whitelisted addresses | `getKrakenWhitelistedAddresses()` / `useGetKrakenWhitelistedAddresses()` |
| start a transfer | `createKrakenExchangeTransfer()` / `useCreateKrakenExchangeTransfer()` |

**Coinbase.** See [`getCoinbaseAccounts`](https://docs.dynamic.xyz/docs/javascript/funding/get-coinbase-accounts) and [`createCoinbaseExchangeTransfer`](https://docs.dynamic.xyz/docs/javascript/funding/create-coinbase-exchange-transfer). Unlike Kraken, a Coinbase transfer can also require a two-step verification code and, for some transfers, recipient identity details (the "Travel Rule"); both are covered on the transfer function's reference page.

| React SDK | JavaScript SDK |
| - | - |
| `useExchangeAccounts()` | `getCoinbaseAccounts()` / `useGetCoinbaseAccounts()` |
| start a transfer | `createCoinbaseExchangeTransfer()` / `useCreateCoinbaseExchangeTransfer()` |

## The funding menu (what the widget did for you)

`useOpenFundingOptions` and `usePayWithDynamic` opened the widget's funding chooser. There is no modal to open now — and no runtime API that reports which funding methods are enabled, so decide which paths to offer based on what you've configured in your Dynamic Console, render your own "add funds" menu, and route each choice to the function above. For a payment experience, compose a Flow payment as described in [Build a custom payment UI](https://docs.dynamic.xyz/docs/javascript/reference/flow-ui-guide.md). Concretely, you now own:

* **The "add funds" menu** — the chooser that offered wallet transfer, on-ramp, and exchange.
* **Provider surfaces** — where you open the on-ramp URL (tab, popup, or embedded frame) and how you reconcile the result.
* **Transfer forms** — amount, token, and recipient inputs feeding `transferAmount()`.
* **Progress & receipts** — the confirmation UI once a transfer or order completes.

## Errors you now own

| Situation | What to do |
| - | - |
| `transferAmount` rejects | Nothing was sent — surface the failure and let the user retry with the same inputs. |
| On-ramp URL build fails | The provider or currency isn't available — hide that option or show why it's unavailable. |
| Coinbase order needs verification | Use `getMissingVerificationForCoinbaseOnrampOrder()` to prompt for the missing identity step. |
| Kraken transfer rejects | Check the destination is whitelisted (`getKrakenWhitelistedAddresses()`) and surface the reason. |
| Coinbase transfer rejects | Check whether it's a two-step verification or Travel Rule request (see `createCoinbaseExchangeTransfer`) before treating it as a hard failure. |

## See also

* [Funding flows (Building UI)](https://docs.dynamic.xyz/docs/javascript/building-ui/funding-flows.md) — build the full add-funds menu and provider surfaces
* [Connecting external wallets (Building UI)](https://docs.dynamic.xyz/docs/javascript/building-ui/connecting-external-wallets.md) — add a wallet to fund from
* [Build a custom payment UI](https://docs.dynamic.xyz/docs/javascript/reference/flow-ui-guide.md) — Flow payments and deposits
* [Using connected wallets](https://docs.dynamic.xyz/docs/javascript/migrating-from-react/using-connected-wallets.md) — pick the wallet to transfer from


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.