Receiving payments with Arkade is simple and efficient. Your wallet can generate addresses for both boarding and ark payments, allowing your users to send Bitcoin to you through either method.
To detect when payments are received, you can use Wallet.notifyIncomingFunds() for incoming transactions in real-time.
Copy
Ask AI
// Example function to process incoming fundsasync function processIncomingFunds(notification: IncomingFunds) { // Update your application state switch (notification.type) { case 'vtxo': for (const vtxo of notification.vtxos) { console.log(`Received payment of ${vtxo.amount} sats`); // You might want to store the VTXO in your database await storeVtxoInDatabase(vtxo); // Notify the user showNotification(`Received ${vtxo.amount} sats!`); // Update the UI await refreshBalanceDisplay(); } break; case 'utxo': for (const utxo of notification.utxos) { await storeBoardingUtxoInDatabase(utxo) // Notify the user showNotification(`Received ${utxo.amount} sats on boarding address!`); // Update the UI await refreshBalanceDisplay(); } break; }}// Start the subscriptionconst stop = wallet.notifyIncomingFunds(processIncomingFunds)// Stop the subscriptionstop()