Add the core client plus the account, signer, and relayer packages you need for a classic
Stellar address flow.
createRpcSimContext gives prepare() a
recording simulator over the Soroban RPC.transfer to build the payment intent.pay - which runs prepare -> sign -> send in one call.receipt.transferTx).// Quickstart - classic gasless USDC transfer (browser; NO apiKey).
import { createBuckspayClient, createRpcSimContext } from "@buckspay/core";
import { classicAccount } from "@buckspay/accounts/classic";
import { walletsKit } from "@buckspay/signers/wallets-kit";
import { buckspayFacilitator } from "@buckspay/relayer/buckspay-facilitator";
const USDC_SAC: string = "CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA";
const MERCHANT: string = "GA6HCMBLTZS5VYYBCATRBR5VBZJEH5C2OON6XQGB3RNYDDAQ7JZ65YQH";
export async function quickstart(): Promise<void> {
const buckspay = createBuckspayClient(
{
network: "testnet",
account: classicAccount(),
signer: walletsKit({ network: "testnet" }),
// url points at YOUR backend, which forwards to the facilitator with the key server-side.
relayer: buckspayFacilitator({ url: "/api/gasless", network: "testnet" }),
gas: { mode: "sponsored" }
},
// prepare() simulates against the Soroban RPC.
createRpcSimContext("https://soroban-testnet.stellar.org")
);
await buckspay.connect(); // wallet + ensureReady
const call = buckspay.transfer({ token: USDC_SAC, to: MERCHANT, amount: "1.50" });
const receipt = await buckspay.pay([call]); // prepare -> sign -> send
console.log(receipt.transferTx); // settled on testnet
}
No API key in the browser.
url: "/api/gasless" points at your backend route, which
forwards the request to the facilitator with the secret key server-side.
See BFF / backend integration for the route implementation.
{
ok: true,
via: "buckspay_self",
token: "CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA",
chain: "stellar-testnet",
transferTx: "a1b2c3...", // transaction hash - verify on Stellar Expert
ledger: 54321,
status: "SUCCESS"
}
Paste
transferTx into Stellar Expert (testnet) to confirm
the payment landed.Next steps
Account models
Classic G-addresses vs. smart-contract accounts (passkey and multi-sig).
Gasless modes
Sponsored, fee-forwarding, and session-based gas strategies.
React hooks
Drop-in hooks for React apps -
useWallet, useStellarPay, and BuckspayProvider.
