Installation
SDK package installation, requirements, and project integration steps.
Requirements
- Node.js 18+ or Bun runtime
- API key generated from the HsrcPay Dashboard
- Secure environment variable management (
.env, secret manager, CI variables)
Package installation
npm install @hsrcpay/sdkEnvironment variables
HSRCPAY_API_KEY=sk_test_xxxxxxxxx
HSRCPAY_ENVIRONMENT=sandboxBasic client example
import { HsrcPay } from "@hsrcpay/sdk";
export const hsrcpay = new HsrcPay({
apiKey: process.env.HSRCPAY_API_KEY!,
environment: process.env.HSRCPAY_ENVIRONMENT === "production" ? "production" : "sandbox",
timeoutMs: 10_000,
});Health check
On first integration, verify connectivity with a low-risk list or get call:
const providers = await hsrcpay.paymentProviders.list({ limit: 5 });
console.log("provider count", providers.data.length);Pre-prod recommendation
Validating the installation step with a separate smoke-check job in your deployment pipeline significantly reduces live release risk.