Skip to content
Blog

Wallet Payments

For users who have a browser wallet installed, paying can be as simple as clicking a button. The SDK connects to their wallet, builds the transaction, gets it signed, submits it to the Solana network, and verifies confirmation, all in a single call. No QR code scanning, no copy-pasting addresses.

Supported wallets: Phantom, Backpack, Solflare.

import { Tribe } from "@tribecloud/sdk";
const status = await tribe.sendViaWallet({
mint: "SOL",
amount: "0.5",
memo: "Order #123",
});
// status.status — "confirmed" | "pending" | "expired"
// status.txSignature — Solana transaction signature

Behind the scenes, sendViaWallet() handles:

  1. Creating a payment record on the Tribe server
  2. Connecting to the user’s wallet
  3. Building and signing the Solana transaction
  4. Submitting it to the network
  5. Verifying confirmation
function PayButton({ mint, amount, memo }) {
const [status, setStatus] = useState("idle");
if (!tribe.isWalletAvailable()) {
return <p>Install a Solana wallet to pay</p>;
}
const pay = async () => {
setStatus("loading");
try {
const result = await tribe.sendViaWallet({ mint, amount, memo });
setStatus(result.status === "confirmed" ? "confirmed" : "error");
} catch (err) {
console.error(err);
setStatus("error");
}
};
return (
<button onClick={pay} disabled={status === "loading"}>
{status === "loading"
? "Confirming..."
: status === "confirmed"
? "Paid!"
: `Pay ${amount} ${mint === "SOL" ? "SOL" : "tokens"}`}
</button>
);
}

Accepting SPL tokens like USDC works the same way. Pass the token’s mint address instead of "SOL":

await tribe.sendViaWallet({
mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", // USDC
amount: "5.00",
});

To show individual buttons for each wallet the user has installed, detectWallets() gives you that information:

const wallets = tribe.detectWallets();
// [{ id: "phantom", name: "Phantom" }, { id: "backpack", name: "Backpack" }]