@elapse/sdk is a TypeScript client for Node 20 and newer. It is the whole surface: if a method is not here, it is not in the API for merchants. Every call maps to one operation in the API reference; a CI check keeps this page, the package, and the reference in step.
This package does not put React in your frontend. It runs on your server, where your secret key
belongs. On the page, the subscriber signs in a window Elapse opens — with the
React components, or with one script tag and no framework at
all if your app is Vue, Rails, Django or plain HTML.
snake_case on the wire; the SDK maps them. Rates and amounts are decimal strings in both. Errors throw typed classes that all extend ElapseError: ElapseAuthenticationError, ElapseInvalidRequestError (a 404 is one of these with type: "not_found"), ElapseRateLimitError, ElapseAPIError, and ElapseSignatureVerificationError from constructEvent.
Products
products.create
products.retrieve
products.list
Checkout
checkout.sessions.create
Subscriptions
subscriptions.retrieve
subscriptions.list
subscriptions.cancel
subscriptions.start
Starts the meter for a Subscription the subscriber has already authorised. Use it when billing
should begin once your resource is ready rather than at checkout; active arrives by webhook
once the chain confirms.
subscriptions.pause
Pauses the meter without ending the subscription, for merchants that bill only while their
resource is working. Paused seconds are never billed; paused arrives by webhook once the chain
confirms.
subscriptions.resume
Resumes a paused meter. Billing starts again when the chain confirms, and the paused time costs
the subscriber nothing.
Customers
customers.retrieve
Invoices
invoices.list
Webhooks
webhooks.constructEvent
constructEvent for handlers that never construct a client.
Options
new Elapse({ secretKey, baseUrl, maxRetries, timeoutMs }). Retries apply to network errors, 429 and 5xx, with exponential backoff and Retry-After honoured; maxRetries defaults to 2 and timeoutMs to 30 seconds. Pass { idempotencyKey } as the second argument to any create call to make it safe to repeat.