Skip to main content

Sessions API

The Sessions API provides a Stripe-like checkout model: create a session server-side with a secret key, then redirect users to complete payment using a public key and client secret. See the Session-Based Checkout guide for integration walkthroughs and examples.

Base URL

POST|GET /v1/sessions/*

Create Session

Creates a new checkout session. Returns a clientSecret that authorizes frontend operations.
POST /v1/sessions
Authentication: Secret key (sk_) required via Authorization: Bearer sk_...

Request Body

ParameterTypeRequiredDescription
externalCustomerIdstringYes*Your user/player ID (max 255 chars)
customerIdstring (UUID)Yes*NowRamp customer UUID. At least one of externalCustomerId or customerId is required.
typestringNo"onramp" (default) or "offramp"
sourceAmountstring or numberNoFiat amount (e.g., "100")
sourceCurrencystringNoFiat currency code (e.g., "USD")
destinationCurrencystringNoCrypto currency code (e.g., "ETH")
networkstringNoBlockchain network (e.g., "ethereum")
destinationAddressstringNoWallet address (max 255 chars)
redirectUrlstring (URL)NoRedirect URL after payment completes
countrystringNoISO 3166-1 alpha-2 country code (auto-detected from IP if omitted)
expiresInSecondsnumberNoSession TTL. Default: 1800 (30 min). Max: 86400 (24 hours).
metadataobjectNoPartner data attached to the session. When an order is created from the session, this is persisted as order.metadata.partnerMetadata and included in webhook payloads. Max 20 keys, 4KB, 2 levels of nesting.
fieldLocksobjectNoExplicit field lock configuration

Field Locks

Fields provided in the session are automatically locked. Use fieldLocks to override:
{
  "destinationAddress": "0x742d...",
  "fieldLocks": {
    "destinationAddress": { "locked": true },
    "sourceAmount": { "locked": true, "min": 10, "max": 1000 }
  }
}
Lock FieldDescription
destinationAddressWallet address
networkBlockchain network
destinationCurrencyCrypto currency
sourceAmountFiat amount (supports min/max range)
sourceCurrencyFiat currency

Request Example

curl -X POST https://api.nowramp.com/v1/sessions \
  -H "Authorization: Bearer sk_live_abc123..." \
  -H "Content-Type: application/json" \
  -d '{
    "externalCustomerId": "player_12345",
    "sourceAmount": "100",
    "sourceCurrency": "USD",
    "destinationCurrency": "ETH",
    "network": "ethereum",
    "destinationAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f1bD21",
    "redirectUrl": "https://yoursite.com/success",
    "type": "onramp"
  }'

Response (201 Created)

{
  "type": "session",
  "id": "sess_abc123",
  "attributes": {
    "sessionId": "sess_abc123",
    "projectId": "550e8400-e29b-41d4-a716-446655440000",
    "clientSecret": "sess_secret_xyz789",
    "type": "onramp",
    "status": "pending",
    "customerId": "cust_uuid",
    "externalCustomerId": "player_12345",
    "sourceAmount": "100",
    "sourceCurrency": "USD",
    "destinationCurrency": "ETH",
    "destinationAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f1bD21",
    "network": "ethereum",
    "redirectUrl": "https://yoursite.com/success",
    "fieldLocks": {
      "sourceAmount": { "locked": true },
      "sourceCurrency": { "locked": true },
      "destinationCurrency": { "locked": true },
      "destinationAddress": { "locked": true },
      "network": { "locked": true }
    },
    "expiresAt": "2026-02-17T15:30:00Z",
    "createdAt": "2026-02-17T15:00:00Z"
  }
}
The clientSecret is only returned on creation. Store it immediately — it cannot be retrieved later.

Get Session

Retrieve session details and current status.
GET /v1/sessions/:sessionId
Authentication: Public key (pk_) or secret key (sk_) via Authorization: Bearer ...

Response

Same structure as creation response, but without clientSecret.

Confirm Session

Optionally confirm a session and update the wallet address or network before creating an order.
POST /v1/sessions/:sessionId/confirm
Authentication: Public key (pk_) via Authorization: Bearer pk_...

Request Body

ParameterTypeRequiredDescription
clientSecretstringYesClient secret from session creation
destinationAddressstringNoUpdated wallet address
networkstringNoUpdated network
Confirm is optional. You can go directly from session creation to order creation.

Create Order from Session

Creates an order from the session, returning a checkout URL for the chosen payment gateway.
POST /v1/sessions/:sessionId/order
Authentication: Public key (pk_) via Authorization: Bearer pk_...

Request Body

ParameterTypeRequiredDescription
clientSecretstringYesClient secret from session creation
fiatAmountstring or numberYesFiat amount
cryptoCurrencystringYesCrypto currency code
networkstringYesBlockchain network
fiatCurrencystringNoFiat currency (defaults to session’s sourceCurrency)
walletAddressstringNoWallet address (defaults to session’s destinationAddress)
gatewaystringNoGateway ID (falls back to project default)
emailstringNoCustomer email

Request Example

curl -X POST https://api.nowramp.com/v1/sessions/sess_abc123/order \
  -H "Authorization: Bearer pk_live_xyz..." \
  -H "Content-Type: application/json" \
  -d '{
    "clientSecret": "sess_secret_xyz789",
    "fiatAmount": "100",
    "fiatCurrency": "USD",
    "cryptoCurrency": "ETH",
    "network": "ethereum",
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f1bD21",
    "gateway": "gateway_a",
    "email": "user@example.com"
  }'

Response (201 Created)

{
  "type": "order",
  "id": "ord_xyz",
  "attributes": {
    "orderId": "ord_xyz",
    "status": "created",
    "sessionId": "sess_abc123",
    "checkout": {
      "method": "redirect",
      "url": "https://checkout.gateway-a.com/...",
      "expiresAt": 1800
    }
  }
}
Redirect the user to checkout.url to complete payment.

Cancel Session

Cancel a pending session. Only available from the backend.
POST /v1/sessions/:sessionId/cancel
Authentication: Secret key (sk_) via Authorization: Bearer sk_...

List Sessions

List sessions for the current project with filtering and pagination.
GET /v1/sessions
Authentication: Secret key (sk_) via Authorization: Bearer sk_...

Query Parameters

ParameterTypeDescription
pagenumberPage number (default: 1)
pageSizenumberResults per page (default: 25, max: 100)
statusstringFilter by status: pending, confirmed, processing, completed, expired, cancelled
customerIdstringFilter by customer UUID
externalCustomerIdstringFilter by external customer ID

Error Codes

CodeHTTPDescription
SESSION_EXPIRED409Session TTL exceeded. Create a new session.
SESSION_ALREADY_USED409An order was already created from this session.
FORBIDDEN403Invalid clientSecret or insufficient permissions.
VALIDATION_ERROR400Missing or invalid request fields.
NOT_FOUND404Session not found.