Session-Based Checkout
Sessions let you create a secure, tamper-proof checkout from your backend using a secret key (sk_), then redirect users to complete payment. This is ideal when you need server-side control over transaction parameters — locking the wallet address, amount, or currency so the end user can’t change them.
There are two variants:
How It Works
Step 1: Create a Session
Create a session from your backend using your secret key (sk_). This is the only step that requires a secret key — everything else uses public keys or no auth.
Request
Session
metadata flows into order.metadata.partnerMetadata when an order is created. The same data is included in order.created and order.completed webhook payloads, so you can correlate orders back to your system without extra lookups.Response (201 Created)
Session Fields
Auto-Locking
When you provide a field value in the session, it is automatically locked — the user cannot change it in the checkout UI. For example, if you setdestinationAddress, the wallet address field will be read-only.
You can override this behavior with explicit fieldLocks:
Step 2: Redirect to Checkout
After creating the session, you have two options.Option A: Hosted Checkout (Recommended)
Redirect the user to our hosted checkout page. We handle the full checkout UI — currency selection, quote comparison, payment, and redirect.- Loads the session and applies field locks
- Shows available currencies and payment methods (filtered by user’s country)
- Fetches live quotes from all enabled gateways
- Lets the user select a gateway and confirm
- Redirects to the payment gateway for checkout
- After payment, redirects back to your
redirectUrl
What Is Hosted Checkout?
Hosted checkout is a pre-built, NowRamp-hosted checkout page that partners can redirect users to instead of building their own UI. Think of it like Stripe Checkout — you create a session on your server and send the user to our page to complete payment. Benefits:- Zero frontend work — no React components or SDK needed
- Always up to date — new gateways, currencies, and features are available immediately
- Responsive — works on mobile and desktop
- Partner branding — custom logo, colors, and background per project
- Secure — session parameters are locked server-side, preventing client-side tampering
- You want the fastest possible integration
- You don’t need a custom checkout UI
- You’re building a backend-only integration (mobile apps, game servers, etc.)
- You want to redirect users from any platform (web, mobile, email links)
Option B: Custom UI
If you want full control over the checkout experience, use the session endpoints combined with the public onramp API to build your own UI.2a. Load the Session (frontend)
2b. Fetch Quotes (no auth needed)
2c. Create Order from Session
When the user selects a quote and confirms, create the order:2d. Redirect to Payment Gateway
Open thecheckout.url in the user’s browser:
checkout.method):
After payment, the gateway redirects the user back to the
redirectUrl from the session.
Step 3: Track the Transaction
Option A: Webhooks (Recommended)
Configure a webhook URL in the Partner Dashboard to receive real-time notifications:Option B: Poll the Transaction Status
Authentication Summary
Session Lifecycle
Error Handling
Full Example: Hosted Checkout (curl)
Environments
Use sandbox for testing. All the same endpoints work with
sk_test_ / pk_test_ keys.
Passing Your Order ID (Partner Metadata)
A common need is to attach your own order ID, user ID, or other tracking data to a session so you can match it back when you receive webhooks. Use themetadata field on session creation — it flows through the entire pipeline automatically.
Step 1: Attach metadata when creating the session
Step 2: User completes checkout
Your metadata is stored on the session. When an order is created (either via hosted checkout or your custom UI), the metadata is automatically propagated to the order aspartnerMetadata.
Step 3: Receive it in webhooks
When the order completes (or fails, is refunded, etc.), your webhook receives the full metadata:Step 4: Match it back in your webhook handler
Metadata limits
Also works with direct checkout-intent
If you’re using the onramp API directly (without sessions), passpartnerMetadata on the checkout-intent request:
System keys (
provider, providerOrderId, email, paymentMethodId) are reserved at the top level of order metadata. Your data is always safely namespaced under partnerMetadata — even if you pass keys with the same names, they won’t overwrite the system values.Next Steps
Callback URLs
Set up webhooks to track transaction status in real-time
Onramp API
Full API reference for quotes, checkout, and transactions
Authentication
API key types, rate limits, and security best practices
React Components
Drop-in checkout form if you want an embedded UI instead