This example shows how Lazorkit smart wallets can power subscription-style payments using USDC, without requiring users to manage gas or private keys.
The user connects once using passkey authentication.
A USDC transfer instruction represents the subscription charge.
Lazorkit paymaster sponsors the transaction fee.
Minimal subscription-style USDC billing using Lazorkit smart wallets.
import { useWallet } from "@lazorkit/wallet";
import { PublicKey } from "@solana/web3.js";
import { createTransferInstruction } from "@solana/spl-token";
const MERCHANT = new PublicKey("MERCHANT_WALLET_ADDRESS");
export function SubscribeButton() {
const { smartWalletPubkey, signAndSendTransaction } = useWallet();
async function subscribe() {
if (!smartWalletPubkey) return;
// Build a USDC payment instruction (represents one billing cycle)
const ix = createTransferInstruction(
smartWalletPubkey, // payer (simplified for example)
MERCHANT, // subscription owner
smartWalletPubkey,
5_000_000 // 5 USDC (6 decimals)
);
// Lazorkit signs & sends using passkeys (no wallet extensions)
await signAndSendTransaction({
instructions: [ix],
transactionOptions: { feeToken: "USDC" },
});
}
return <button onClick={subscribe}>Subscribe – 5 USDC / month</button>;
}