Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.crypto.westminister.tech/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Custodial corridor remittance is separate from the P2P-style POST /api/v1/auth/remittance/off-ramp/orders path. The customer already holds USDT or USDC in a custodial platform wallet. They choose a corridor (for example GB → KE). They enter how much KES the beneficiary should receive. The app resolves pricing and FX. The backend creates a draft with a unique escrow address. On Confirm, the server creates an order with order_subtype = custodial_remittance_offramp, then broadcasts the priced stablecoin (USDT or USDC) from the custodial wallet to that escrow. After confirmations, M-Pesa B2C pays beneficiary_phone.

Prerequisites

  1. Run database migration 000031_corridors_custodial_remittance on your environment.
  2. Seed at least one row in corridors with vendor_id and offer_id pointing to your platform pricing anchor (same commercial pattern as other off-ramp listings).
  3. Create offramp pricing_profiles and fx_rate_quotes for USDT or USDC (paired with KES) on the sender network (for example tron).

Mobile sequence

  1. GET /api/v1/auth/remittance/custodial/corridors — populate destination and corridor selection.
  2. POST /api/v1/auth/pricing/resolve or POST /api/v1/auth/pricing/fx-quotes (and profiles) as you do today — obtain pricing_profile_id and fx_rate_quote_id for flow_type = offramp.
  3. POST /api/v1/auth/remittance/custodial/drafts — body includes corridor_id, custodial_wallet_id, beneficiary_fiat_amount, fiat_currency, beneficiary and sender KYC fields, fee_bearer, and the pricing IDs. The response includes usdt_total_debit (total stablecoin debit for USDT- or USDC-priced flows; field name is historical) and escrow_wallet_address for the summary screen.
  4. POST /api/v1/auth/remittance/custodial/drafts/{id}/confirm — empty JSON body is fine. The server creates the order and submits the on-chain transfer from the custodial wallet to the draft escrow.
Drafts expire in 15 minutes. If the chain send fails, the order may move to failed while the draft stays draft with a linked order_id. A second confirm retries the transfer for the same order.

Order shape

Confirmed orders use order_type = OFF_RAMP_SELL, payment_method = custodial_remittance_escrow, and order_subtype = custodial_remittance_offramp. corridor_id is stored on the order when present. Payout orchestration uses beneficiary_phone for M-Pesa, same as remittance_offramp. See Orders and payments for standard off-ramp and the listing-based remittance endpoint. See Pricing and FX for quote-backed enforcement.