Skip to main content
Fiat ramp flows bridge the gap between local currencies and on-chain tokens — they are the moment where a farmer in Kano pays NGN to receive RWA token shares, or an investor sells their position back into KES. Ankara Chain’s RampManager splits this into two halves: an off-chain provider (quotes, session creation, and status polling against a real payment processor or a dev-mode stub) and an optional on-chain settlement contract (RampSettlement) that holds off-ramp custody and writes a permanent record of on-ramp mints. You can use either half on its own, or combine them for a fully verifiable ramp flow.

Ramp providers

A RampProvider is a pluggable interface — swap implementations without changing any calling code. The SDK ships two built-in providers; you can also write your own against the RampProvider interface, or use createRampProvider() to select one from a config object.

ManualRampProvider (dev / testing)

ManualRampProvider uses in-memory sessions and configurable exchange rates — no real network calls, no API keys. It is the right default for local development and tests.
In tests, call provider.markSettled(sessionId) or provider.markFailed(sessionId) to simulate payment outcomes without any real fiat movement.

StellarAnchorProvider (SEP-24)

StellarAnchorProvider connects to any Stellar-compatible anchor (Cowrie, MoneyGram, Bitso) purely by home domain. It handles SEP-10 authentication, SEP-24 interactive deposit/withdrawal, and optional SEP-38 quotes transparently.
StellarAnchorProvider makes real HTTP calls to the anchor on every method. Verify your chosen anchor’s SEP-24 implementation on testnet before going live.

MoonPay

To use MoonPay, pass a RampProviderSelection with provider: "moonpay" to createRampProvider(). createRampProvider lives in the @ankarachain/sdk/server entry point — it keeps Node.js-only signing code out of browser bundles. Only call this server-side or in a backend service:

Custom provider

Implement the RampProvider interface to connect any payment processor — Yellow Card, Flutterwave, Transak, or your own API:

createRampProvider()

Use createRampProvider() for declarative provider selection from a config object — useful for reading provider settings from environment variables without importing provider classes directly. It is exported from @ankarachain/sdk/server (a server-only entry point) because the moonpay selection links in Node.js signing code:
For Stellar anchors, use RampManager.connectAnchor() instead of createRampProvider() — the stellar-anchor selection requires a StellarExternalSigner that connectAnchor wires in for you.

Using separate providers per direction

If your on-ramp and off-ramp go through different processors — for example MoonPay in, a Stellar anchor out — use RampManager.withProviders():

Getting a quote

Call ramp.getQuote() before initiating a session to show the user what they’ll pay or receive. Provide either fiatAmount or tokenAmount — not both:
RampQuote shape:

Initiating an on-ramp

An on-ramp session creates a payment URL where the user completes fiat payment. After they pay, the provider triggers a webhook (or you poll getStatus) and you mint the corresponding tokens.
Poll for status:

Initiating an off-ramp

An off-ramp session accepts a RampPayoutAccount that describes the user’s bank or mobile-money account:

On-chain settlement (optional)

The RampSettlement contract provides a custody layer and an on-chain audit trail. Deploy one per platform (not per user):
Then pass the settlement address to RampManager:

depositOffRamp

After the user initiates an off-ramp session, they deposit their tokens into the settlement contract. On EVM, approve the contract first:

confirmOffRampSettlement

Once the provider confirms the fiat payout succeeded, release the custodied tokens to the treasury:

recordOnRampSettlement

Record an attestation that an on-ramp mint happened. This does not move funds — call it after you have already minted the tokens:

CLI ramp commands


Supported fiat currencies

Additional currencies can be supported by configuring custom exchange rates in ManualRampProvider, or by connecting an anchor / payment processor that covers those markets.

RampSessionStatus reference