Skip to main content
@buckspay/core is the platform-agnostic heart of the SDK. You can use it directly - without any React layer - in Node.js scripts, backend workers, or any environment where you control the signer manually. The surface is the same three-phase flow described in Prepare -> Sign -> Send: createBuckspayClient assembles the client; createRpcSimContext gives prepare() a Soroban simulator; then connect() -> pay() (or the split prepare / sign / send) executes the payment.
1
Install
2
pnpm add @buckspay/core @buckspay/accounts @buckspay/signers @buckspay/relayer
3
Create the client
4
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 client = createBuckspayClient(
  {
    network: "testnet",
    account: classicAccount(),
    signer: walletsKit({ network: "testnet" }),
    relayer: buckspayFacilitator({ url: "/api/gasless", network: "testnet" }),
    gas: { mode: "sponsored" }
  },
  createRpcSimContext("https://soroban-testnet.stellar.org")
);
5
Connect and pay
6
await client.connect();
const call = client.transfer({ token: USDC_SAC, to: MERCHANT, amount: "1.50" });
const receipt = await client.pay([call]);
console.log(receipt.transferTx);

When to use the core directly

ScenarioRecommended approach
React / React Native app@buckspay/react or @buckspay/react-native
Next.js App Router BFF route@buckspay/nextjs
Node.js script, backend worker, or CLI@buckspay/core directly
Server-side relay (any framework)createBuckspayClient + buckspayFacilitator({ apiKey }) - server-only
When using @buckspay/core in a server-side relay, pass apiKey to buckspayFacilitator as an environment variable. The API key must never appear in a browser bundle.

Full quickstart example

// 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
}

Next

Quickstart

The full quickstart walkthrough with a classic G-address account.

Prepare -> Sign -> Send

The three-phase flow and where the BFF slot fits.