walletku-sdk
v1.0.0
Published
SDK resmi Walletku Payment Gateway (server-side): create payment QRIS/VA/e-wallet/cstore, refund, disbursement, vault, sub-merchant, verifikasi webhook.
Maintainers
Readme
walletku-sdk (Node.js)
SDK resmi Walletku untuk backend Node ≥ 18 — tanpa dependensi.
PENTING: SDK ini memegang
apiSecret. Hanya untuk server Anda — jangan pernah ditanam di aplikasi mobile/frontend.
Instalasi
# dari registry (bila tersedia) …
npm install walletku-sdk
# … atau langsung dari tarball resmi:
npm install https://docs.walletku.net/sdk/files/walletku-sdk-1.0.0.tgzPakai
import { WalletkuClient, verifyWebhook } from 'walletku-sdk';
const wk = new WalletkuClient({
merchantId: 'MID-000001',
apiSecret: process.env.WALLETKU_API_SECRET,
baseUrl: 'https://sandbox-pay.walletku.net', // production: https://pay.walletku.net
});
const pay = await wk.createPayment(
{ referenceId: 'INV-001', amount: 150000, paymentMethod: 'qris' },
'INV-001', // X-External-Id (idempotency — retry 5xx dgn nilai SAMA)
);
// webhook — verifikasi atas RAW BODY mentah, jangan re-serialize
app.post('/webhooks/walletku', (req, res) => {
const ok = verifyWebhook({
rawBody: req.rawBody,
signature: req.headers['x-webhook-signature'],
timestamp: req.headers['x-webhook-timestamp'],
webhookSecret: process.env.WALLETKU_WEBHOOK_SECRET,
});
if (!ok) return res.status(401).end();
res.status(200).end(); // balas cepat; proses di background
});Cocokkan implementasi Anda dengan test vector resmi: https://docs.walletku.net/sdk/files/test-vectors.json
Dokumentasi lengkap: https://docs.walletku.net · Contoh app: https://docs.walletku.net/sdk/
