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
Context
app/api/withdrawals/route.tscurrently has a stubinitiateOfframp()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 clientOFFRAMP_API_KEY,OFFRAMP_API_SECRET)transactionIdfor status tracking2. Update
app/api/withdrawals/route.tsinitiateOfframp()calltransactionId+status: 'pending'on theWithdrawalrecord3. Environment variables needed
Acceptance criteria
POST /api/withdrawalssuccessfully initiates a withdrawal via the off-ramp APItransactionIdand initialstatus