Python
hostpay on PyPI — Python 3.8+TypeScript
@hostpay/sdk on npm — Node 18+, zero runtime dependenciesInstall
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.Async (Python)
The Python SDK also shipsAsyncHostPay (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 theX-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
Fromhostpay 0.4.0 / @hostpay/sdk 0.3.0 the SDKs also cover:
- Fees —
client.fees: fee summary, configuration, and deposit / withdrawal / transfer / card-metadata estimates - Webhook subscriptions —
client.webhooks.subscriptions: create, list, update, delete, and rotate-secret (the create and rotate responses include the signing secret once — store it) - Transaction sync —
client.transactions.sync(reference_id)for instant post-payment status - Test-mode simulator —
client.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")
hostpay 0.5.0 / @hostpay/sdk 0.4.0:
- Stripe Connect onboarding —
client.connect: complete onboarding (requires the end customer’s IP for Stripe TOS acceptance), verification document upload, status sync, and deletion - Partial user update —
client.users.patch(...): change only the fields you send