Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Business-User Sign-in

Integrate OTP-based sign-in for an existing Ramp business user in the hosted checkout flow.

How to integrate the business user OTP-based checkout flow, used when a business is redirected to the hosted checkout and the business user needs to authenticate before transacting.

Who this is for

This flow signs an existing business user into an integration. For ordinary server-to-server integration, start with the API-key quickstart. For customer payment pages, use Hosted checkout.

Business-user JWTs, merchant keys and customer JWTs have different scopes. Use the credential listed by each endpoint; they are not interchangeable. Checkout confirmation requires the customer's JWT.

Step 1: Send OTP

POST /api/v1/auth/business-twofactor
Content-Type: application/json

{ "email": "owner@acme.com" }
  • Response: 200 { "success": true, "message": "Business two-factor code sent" }

  • A 6-digit numeric OTP is emailed to the user. Token expiry: 2 minutes.

  • Throttling: 5 requests/min per IP. Unknown emails return 200 (no enumeration).

Step 2: Resend OTP (if needed)

POST /api/v1/auth/business-twofactor/resend
Content-Type: application/json

{ "email": "owner@acme.com" }
  • Same response shape.

  • Throttling: 5 requests/min per IP and 30s cooldown per user. Hitting the per-user cooldown returns 429 with { "message": "Please wait before requesting another code" }.

  • The token's expiresAt is refreshed to now + 2min on every send.

Step 3: Verify OTP and receive JWT

Response:

Store data.token.accessToken: you'll send it as Authorization: Bearer <accessToken> on every subsequent call.

Step 4: Call checkout endpoints

All routes below accept Authorization: Bearer <businessUserAccessToken>.

On-ramp (full session, including merchant-flow features)

Off-ramp

Public read endpoints (no auth required)

Useful at the start of the checkout to populate UI before the user has authed:

Hybrid-auth read endpoints (API key OR business JWT)

These require authentication but accept either auth mode via HybridHTTPAuthGuard:


End-to-end example (curl)


Scope and recovery

  • A business user can initiate an on-ramp for a customer of their active business. Off-ramp initiation requires the server's API key.

  • Checkout confirmation requires a customer JWT and can only confirm that customer's order. A business JWT does not replace customer consent.

  • Refresh GETs recover an existing result. Mutations use POST with a saved idempotency key and source identifier: on-ramp refresh, off-ramp refresh.

  • A user without an active business receives 401 Merchant context unavailable on business-scoped operations.

Errors you'll see

HTTP
When

200 (silent) on /business-twofactor

Unknown email: by design, no enumeration

400 Invalid token on /verify

OTP wrong or already expired (2 min window)

429 Please wait before requesting another code

Resend hit the 30s per-user cooldown

429 ThrottlerException

Hit the 5/min IP throttle on send/resend

401 Merchant context unavailable

JWT valid but user has no active business

409 DUPLICATE_TRANSACTION

reference already used: read the existing transaction before creating another

404 CUSTOMER_NOT_FOUND

email in body doesn't match a customer; use the WithCustomer variant to create inline

Endpoints that remain merchant-only (API key required)

These require API-key authentication:

  • POST /api/v1/onramp/test, POST /api/v1/offramp/webhook/simulate (webhook simulators)

  • POST /api/v1/offramp/crypto-sent (callback hook)

  • GET /api/v1/onramp/minimum-amount/:currency, GET /api/v1/offramp/minimum-amount/:token

  • POST /api/v1/exchange-rates/onramp, POST /api/v1/exchange-rates/offramp

Off-ramp initiation (POST /v1/offramp, /initiate, /checkout/initiate) also requires an API key.

Last updated