Skip to content

[Blocker] Integrate custom off-ramp API for USDC → NGN withdrawal #280

@davedumto

Description

@davedumto

Context

app/api/withdrawals/route.ts currently has a stub initiateOfframp() that throws 'Off-ramp API not yet configured'. The Yellow Card integration was removed. A custom off-ramp API needs to be wired in to allow users to withdraw USDC to a Nigerian bank account.

What needs to be built

1. lib/offramp.ts — Off-ramp API client

export async function initiateOfframp(params: {
  amount: number          // USDC amount
  reference: string       // unique withdrawal ID
  bankAccount: {
    accountNumber: string
    bankCode: string
    accountName: string
  }
}): Promise<{ transactionId: string; status: string }>
  • Calls the custom off-ramp API (endpoint to be provided)
  • Signs requests with API key from env (OFFRAMP_API_KEY, OFFRAMP_API_SECRET)
  • Returns a transactionId for status tracking

2. Update app/api/withdrawals/route.ts

  • Replace stub with real initiateOfframp() call
  • Store transactionId + status: 'pending' on the Withdrawal record
  • Return meaningful error messages for insufficient balance, invalid bank account, etc.

3. Environment variables needed

OFFRAMP_API_KEY=
OFFRAMP_API_SECRET=
OFFRAMP_API_URL=https://...

Acceptance criteria

  • POST /api/withdrawals successfully initiates a withdrawal via the off-ramp API
  • Withdrawal record is stored with transactionId and initial status
  • USDC balance is deducted from user's Stellar wallet before calling the API
  • Proper error handling: insufficient funds, invalid account, API errors
  • Integration test with mocked off-ramp API

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions