Skip to content
LogoLogo

Stellar

SEP-41 token payments on the Stellar network

The Stellar payment method enables payments using SEP-41-compliant tokens on the Stellar network. Stellar supports two intents – charge for one-time on-chain transfers and channel for high-frequency off-chain payment channels – covering everything from single API calls to metered billing at token-level granularity.

The reference implementation is provided by @stellar/mpp, which extends mppx with Stellar-native client and server handlers.

Installation

Why Stellar

Stellar enables several useful capabilities for MPP:

  • 5-second finality: Transactions settle with deterministic confirmation, no probabilistic waiting
  • Sub-cent fees: Transaction costs low enough for micropayments and per-request billing
  • Fee sponsorship: Servers can pay transaction fees on behalf of clients, removing wallet friction entirely
  • Stellar smart contracts: Payment channels run as auditable on-chain contracts for secure reserve and settlement
  • Flexible token support: Any SEP-41 compliant token is supported, which includes smart contract transfers and classic assets (via SAC).
  • Payment channels: Off-chain cumulative commitments enable high-frequency metered billing without per-request on-chain cost

Choosing an intent

ChargeChannel
PatternOne-time payment per requestDeposit once, pay incrementally with commitments
Latency overhead~5s (on-chain confirmation)Near-zero after channel open
ThroughputOne transaction per requestMany commitments per second per channel
Best forSingle API calls, content access, one-off purchasesLLM APIs, metered services, usage-based billing
On-chain costPer requestAmortized across many requests
SettlementImmediate on-chain token transferOff-chain commitments, on-chain close

Intents

Fee sponsorship

Stellar supports server-paid transaction fees for charge intents. When enabled, the server rebuilds the transaction with its own source account and optionally wraps it in a fee bump. The client signs only the Stellar auth entries – no need to hold XLM for gas.

Pass a feePayer configuration to stellar.charge() to enable this:

import { Mppx } from 'mppx/server'
import { stellar } from '@stellar/mpp/charge/server'
import { USDC_SAC_TESTNET } from '@stellar/mpp'
import { Keypair } from '@stellar/stellar-sdk'
 
const mppx = Mppx.create({
  secretKey: process.env.MPP_SECRET_KEY,
  methods: [
    stellar.charge({
      recipient: process.env.STELLAR_RECIPIENT,
      currency: USDC_SAC_TESTNET,
      network: 'stellar:testnet',
      feePayer: {
        envelopeSigner: Keypair.fromSecret('S...'),
      },
    }),
  ],
})

Supported assets

Any SEP-41 compliant token is supported. This includes classic Stellar assets wrapped via SAC, as well as custom smart contract tokens that implement the SEP-41 interface. A few common examples:

  • USDC – Circle's USD stablecoin on Stellar
  • XLM – Stellar's native asset, wrapped as a SEP-41 token via SAC
  • Any custom SEP-41 token – smart contracts implementing the SEP-41 token interface

The @stellar/mpp package exports constants for commonly used token addresses (USDC_SAC_MAINNET, USDC_SAC_TESTNET, XLM_SAC_MAINNET, XLM_SAC_TESTNET).