Quickstart
Stand up your first payment flow with the HsrcPay SDK in minutes.
A shortened flow so you can try end to end in sandbox in about fifteen minutes. For REST details see API Reference; for concepts see Documentation.
1) Install
npm install @hsrcpay/sdk2) Client
import { HsrcPay } from "@hsrcpay/sdk";
export const hsrcpay = new HsrcPay({
apiKey: process.env.HSRCPAY_API_KEY!,
environment: "sandbox",
});3) Payment + confirm
const payment = await hsrcpay.payments.create({
amount: 12500,
currency: "TRY",
metadata: { orderId: "ORD-2026-0001" },
});
const confirmed = await hsrcpay.payments.confirm(payment.id, {
paymentMethod: { id: process.env.SANDBOX_PM_ID! },
payerIdentity: { ipAddress: "203.0.113.1", userAgent: "demo/1.0" },
});
console.log(confirmed.payment.status);4) Verify
const latest = await hsrcpay.payments.get(payment.id);For webhook setup see Webhooks; before production see Pre-Production Checklist.
Environment separation
Do not mix sandbox and production keys in the same deployment.