FundWallet
The SDK comes with a built-in Coinbase Pay integration.
Coinbase Pay allows you to implement a fiat-to-crypto on-ramp within your games for users to easily purchase crypto.
Use the FundWallet
method to begin the following flow:
- A popup window opens where the player can purchase some cryptocurrency directly from their Coinbase account.
- The player returns to the game with the purchased crypto in their wallet.
// Call the "FundWallet" function to trigger the Coinbase Pay flow.
await sdk.wallet.FundWallet(new FundWalletOptions() {
appId = "<your-app-id-here>", // https://docs.cloud.coinbase.com/pay-sdk/docs/using-sdk
address = address, // The wallet address to fund
chainId = 137 // The chain ID of the network to fund
});