Skip to main content
The package is deliberately split so the dangerous part cannot be imported by accident into the wrong runtime.

Payments

Create and read sessions. Server only — carries your secret key.

Webhooks

verifyWebhook — constant-time signature check over the raw body, with the rotation overlap handled. Node only.

Widget

Embed the hosted payment page, optionally bridging a connected wallet.

Swap

Quote a route and get back what the user should execute.

Read client

Chains, tokens, balances, status. Safe anywhere.

Customization

Every knob — theming, the widget bridge, client options, webhook verification.

Import paths

Import from @hypermid/sdk. Everything is re-exported there, and it is what every example in these docs uses. The subpaths exist for tree-shaking and for making the runtime boundary visible at the import site — @hypermid/sdk/payments is the server-only half — but they resolve to the same functions:

The one rule

payments.* sends your secret key. It throws immediately if window exists:
That is a hard throw, not a warning, on purpose. The failure it prevents is silent by nature: the code works perfectly in a browser, and the only symptom is that your secret key is now in a bundle every visitor can read. A warning would be discovered by an attacker, not by you. Everything else — the widget bridge, quoteSwap, the read client — is designed for the browser and takes a publishable key or none at all.

Types

The package ships TypeScript types generated from the same OpenAPI document that produces this documentation, so the types and these pages cannot disagree.
QuoteResponse is exported as ApiQuoteResponse. The name collided: the API’s route quote and the SDK’s own swap result are different shapes, and the established SwapQuote kept the plain name.