Deposit with Exchange gives your users a seamless way to fund their connected wallets directly from centralized exchange accounts like Coinbase and Binance (with more exchanges coming soon). Instead of forcing users to leave your app, log into their exchange, and manually handle withdrawals, you can offer a guided in-app flow that keeps them engaged and ready to transact.
Import the baseUSDC asset, the pay function and the useAppKitAccount hook to get the address of the connected wallet.
Copy
import { baseUSDC, pay } from '@reown/appkit-pay';
Get the address of the connected wallet using the subscribeAccount function.
Copy
let address = null;const appKit = createAppKit({...}); // please check our docs or examples to understand how to create the AppKit instanceappKit.subscribeAccount(state => { address = state['accountState']?.address;})
In order to run the deposit, use the function pay. This function receives three parameters.
Copy
// pay function returns a PaymentResult objectconst result = await pay({ recipient: address, amount: 0.0001, paymentAsset: baseUSDC});if (result.success) { console.log("Payment successful: "+ result.result);} else { console.error("Payment error: "+ result.error);}
For a complete list of supported networks and assets across different exchanges (Coinbase, Binance), please refer to the Networks and Assets Supported section in our Pay with Exchange documentation.