Skip to main content
Official client libraries for the HOST Pay API. Both SDKs cover the full merchant API — users (including list/update/lifecycle), wallets, deposits, transfers, payouts, escrow, and transaction queries — plus webhook signature verification, typed responses, automatic retries, and idempotency support.

Python

hostpay on PyPI — Python 3.8+

TypeScript

@hostpay/sdk on npm — Node 18+, zero runtime dependencies
Source code for both lives at github.com/HOST-SL/hostpay-sdk.

Install

Initialize the client

Pass your credentials once — every call is authenticated automatically. Use Test Mode keys while integrating; the same code works in Live Mode.
The SDKs use your secret-key, so they are server-side only. Never bundle them into browser or mobile code.

Async (Python)

The Python SDK also ships AsyncHostPay (v0.3.0+) — the same surface with every method awaited, for FastAPI, aiohttp, or any asyncio app. The TypeScript client is async by nature (every method returns a Promise).
Python

The money surface

Idempotency

Money-moving calls accept an idempotency key. Reuse the same key to retry safely without double-charging:

Verifying webhooks

Both SDKs verify the X-HostPay-Signature header and reject replayed or tampered deliveries. Pass the raw request body, not a re-parsed object. See Webhook security for details.

Error handling

Errors are typed by HTTP status so you can branch on the cause:

Beyond payments

From hostpay 0.4.0 / @hostpay/sdk 0.3.0 the SDKs also cover:
  • Feesclient.fees: fee summary, configuration, and deposit / withdrawal / transfer / card-metadata estimates
  • Webhook subscriptionsclient.webhooks.subscriptions: create, list, update, delete, and rotate-secret (the create and rotate responses include the signing secret once — store it)
  • Transaction syncclient.transactions.sync(reference_id) for instant post-payment status
  • Test-mode simulatorclient.testing.simulate_monime_webhook(...) to complete or fail a pending Test Mode deposit (rejected in Live Mode)
  • app_info / appInfo — identify your platform in the User-Agent, e.g. HostPay(..., app_info="YourApp/1.0")
And from hostpay 0.5.0 / @hostpay/sdk 0.4.0:
  • Stripe Connect onboardingclient.connect: complete onboarding (requires the end customer’s IP for Stripe TOS acceptance), verification document upload, status sync, and deletion
  • Partial user updateclient.users.patch(...): change only the fields you send

Other languages

Any language that speaks HTTP works — see the API reference for raw request examples, and Authentication for the required headers. The full OpenAPI spec is published in the SDK repository if you want to generate your own client.