P2P payments
Glide lets you build P2P payments in your dapp or wallet where users can pay each other across chains and tokens. For example, a user can send USDC from Arbitrum to a friend who only wants to receive ETH on Base.
Or you can simply let users pay each other the same token, but across different chains. For example, a user can send USDC from Arbitrum to a friend who wants to receive USDC on Base.
Same token, different chains
If you want users to pay each other the same token (ex. ETH or USDC), but across different chains, follow the Instant Bridge guide.
Once you have that working, update the recipient address to the friend's wallet address on the destination chain when creating the session.
import { createSession, currencies, chains } from "@paywithglide/glide-js";
const session = await createSession(glideConfig, {
// The user's wallet address
account: "0xc6FfEB1298Eb33Da430d14e5Eb789256ec344625",
// The *origin* chain where the tokens will be bridged from
// In this case, the user will bridge ETH on Optimism
paymentCurrency: currencies.eth.on(chains.optimism),
// The *destination* chain where the tokens will be bridged to
chainId: chains.base.id,
// The recipient wallet address. Update this to the friend's
// wallet address
address: "0x82D83c72590f745fe734c64DcD8c37179C6D98C7",
// Bridge 0.01 ETH
value: parseEther("0.01"),
});
Different tokens, different chains
If you want users to pay each other different tokens (ex. USDC -> ETH), but across different chains, follow the Cross-chain swaps guide.
Once you have that working, update the recipient address to the friend's wallet address on the destination chain when creating the session.