@meru.app/checkout-node is the server-side SDK for Meru Checkout. Use it on your
backend to create checkout sessions and reconcile their status.
Install
Requires Node 18+ (uses the global
fetch). Zero dependencies.Construct a client
apiKey falls back to process.env.MERU_SECRET_KEY, so you can also construct with
no arguments. Pass an options object to override defaults:
Create a session
1
Create the session
Call
meru.checkouts.create(...). The returned session includes a url to redirect
the customer to, and an id to hand to the React SDK.2
Expose it from your backend
A typical Express handler creates the session and returns the
id/url to your
frontend.Embed the session you created here
Pass
session.id to @meru.app/checkout-react to embed or redirect on the
frontend.Idempotency
Pass anidempotencyKey to make session creation safe to retry. Retrying with the
same key returns the original session instead of creating a duplicate — useful
when a network error leaves you unsure whether the first call succeeded.
1
Create with an idempotency key
2
Retry safely
If the call fails or times out, retry with the same key. The SDK sends an
Idempotency-Key header (scoped to your account), so you get the same session back
rather than a second charge.Use a stable, unique value per logical order (for example, your order id) as the
idempotency key.
Reconcile status
Read a session withmeru.checkouts.retrieve(id) and treat succeeded as paid.
Errors
Any non-2xx response throws aMeruApiError with a .status (HTTP status number)
and .body (the parsed error payload).
Configuration
Construct the client with an options object to override defaults.string
Your Checkout secret key (
sk_live_…). Falls back to
process.env.MERU_SECRET_KEY.string
default:"https://checkout-api.meru.com"
Checkout API base URL. Override for sandbox or self-hosted environments.
number
default:"20000"
Request timeout in milliseconds.
typeof fetch
Custom
fetch implementation. Defaults to the global fetch.API reference
CreateCheckoutParams
number
Amount in fiat. Required for
crypto-exchanges; optional for qr-bolivia (the
form can capture it).string
default:"USD"
ISO currency code for
amountFiat.'crypto-exchanges' | 'qr-bolivia'
Force a payment method. Omit to let the customer choose.
'USDC' | 'USDT'
Stablecoin to receive for crypto payments.
string
Description shown on the checkout.
string
Your order id. Echoed back on the session.
string
External partner identifier.
string
URL to redirect to after a confirmed payment.
string
URL to redirect/return to on cancel.
Record<string, unknown>
Arbitrary key/value pairs, echoed back on reads.
CheckoutSession
string
The session identifier.
string
The hosted checkout URL. Returned by
create only.string
Your order id, echoed back.
string
The description shown on the checkout.
string | null
The fiat amount as a string, or
null.string
ISO currency code for
amountFiat.'mesh' | 'qr_bolivia' | null
The selected method, or
null when the customer still has to choose.string[]
Methods offered for this session.
string
One of
created, pending, processing, succeeded, failed, expired.string | null
On-chain transaction hash for crypto payments, or
null.object
Customer details captured on the checkout page (
name, email, document).string
ISO-8601 creation timestamp.
string
ISO-8601 expiration timestamp.
string | null
ISO-8601 timestamp when payment succeeded, or
null.Related
React SDK
Embed or redirect to the session on the frontend.
Create a session (REST)
The underlying
POST /v1/checkouts reference.Payment status (REST)
The underlying
GET /checkouts/{id} reference.