Overview
The internal/fiat/ package exists in the project structure as a fiat rail abstraction with provider adapters, but the interface and adapters are not yet implemented. Without this layer, Fluxa cannot accept local currency deposits or initiate local currency withdrawals — the core value proposition for emerging market cross-border payments. This issue defines the provider interface and implements the first concrete adapter: Yellow Card, which supports fiat-to-crypto on/off ramps across multiple African markets.
What needs to be built
internal/fiat/ — Provider interface
-
Provider interface with methods: Name(), SupportedCountries(), GetQuote(), InitiateDeposit(), InitiateWithdrawal(), GetStatus(), HandleWebhook()
-
FiatQuote type — local currency amount, USDC equivalent, exchange rate, fee, expiry
-
DepositInstruction type — bank account details or mobile money prompt to show the end user
-
RailEvent type — normalised event type (deposit.confirmed, withdrawal.sent, etc.) + provider reference
internal/fiat/yellowcard/ — Yellow Card adapter
-
Implements the Provider interface against the Yellow Card API
-
GetQuote — calls Yellow Card rates endpoint, returns normalised FiatQuote
-
InitiateDeposit — creates a Yellow Card payment channel, returns bank/mobile money instructions
-
InitiateWithdrawal — submits a Yellow Card payout to a local bank or mobile money number
-
GetStatus — polls Yellow Card for transaction status by provider reference
-
HandleWebhook — verifies Yellow Card HMAC signature, parses event, returns normalised RailEvent
internal/transfer/ — Fiat-linked transfer types
-
Extend Transaction domain type with optional fiat_rail, fiat_provider_ref, fiat_status fields
-
New transfer type: fiat_deposit — creates a deposit instruction via the rail and waits for a deposit.confirmed webhook before crediting the internal wallet
-
New transfer type: fiat_withdrawal — debits the internal wallet, then submits a withdrawal via the rail
New API endpoints
-
POST /v1/fiat/deposit — returns deposit instructions for a given country + local amount
-
POST /v1/fiat/withdraw — initiates a local currency payout from a Fluxa wallet
-
POST /v1/fiat/webhooks/yellowcard — receives and processes Yellow Card webhook events
db/migrations/
-
Extend transactions table: fiat_rail, fiat_provider_ref, fiat_status, local_currency, local_amount
Acceptance criteria
Overview
The
internal/fiat/package exists in the project structure as a fiat rail abstraction with provider adapters, but the interface and adapters are not yet implemented. Without this layer, Fluxa cannot accept local currency deposits or initiate local currency withdrawals — the core value proposition for emerging market cross-border payments. This issue defines the provider interface and implements the first concrete adapter: Yellow Card, which supports fiat-to-crypto on/off ramps across multiple African markets.What needs to be built
internal/fiat/— Provider interfaceProviderinterface with methods:Name(),SupportedCountries(),GetQuote(),InitiateDeposit(),InitiateWithdrawal(),GetStatus(),HandleWebhook()FiatQuotetype — local currency amount, USDC equivalent, exchange rate, fee, expiryDepositInstructiontype — bank account details or mobile money prompt to show the end userRailEventtype — normalised event type (deposit.confirmed,withdrawal.sent, etc.) + provider referenceinternal/fiat/yellowcard/— Yellow Card adapterImplements the
Providerinterface against the Yellow Card APIGetQuote— calls Yellow Card rates endpoint, returns normalisedFiatQuoteInitiateDeposit— creates a Yellow Card payment channel, returns bank/mobile money instructionsInitiateWithdrawal— submits a Yellow Card payout to a local bank or mobile money numberGetStatus— polls Yellow Card for transaction status by provider referenceHandleWebhook— verifies Yellow Card HMAC signature, parses event, returns normalisedRailEventinternal/transfer/— Fiat-linked transfer typesExtend
Transactiondomain type with optionalfiat_rail,fiat_provider_ref,fiat_statusfieldsNew transfer type:
fiat_deposit— creates a deposit instruction via the rail and waits for adeposit.confirmedwebhook before crediting the internal walletNew transfer type:
fiat_withdrawal— debits the internal wallet, then submits a withdrawal via the railNew API endpoints
POST /v1/fiat/deposit— returns deposit instructions for a given country + local amountPOST /v1/fiat/withdraw— initiates a local currency payout from a Fluxa walletPOST /v1/fiat/webhooks/yellowcard— receives and processes Yellow Card webhook eventsdb/migrations/Extend
transactionstable:fiat_rail,fiat_provider_ref,fiat_status,local_currency,local_amountAcceptance criteria
POST /v1/fiat/depositreturns valid bank/mobile money instructions for at least Nigeria, Ghana, and KenyaProviderwith zero changes to the transfer service