Developer Hub

Build on Pakistan's
payment API

REST API, webhook docs, and test credentials. Go from zero to processing sandbox payments in minutes.

Quickstart (Node.js)

📚
Detailed Documentation Available
This is a quick reference. For comprehensive, interactive product documentation and step-by-step guides, please visit the PPay Dashboard Docs.

Create your first payment in 3 lines of code. All requests use HTTPS and return JSON.

quickstart.js
const ppay = require('ppay-node')('sk_test_pk_...');

const intent = await ppay.paymentIntents.create({
  amount: 499900,  // Amount in paisas (₨4,999)
  currency: 'PKR',
  payment_methods: ['card', 'jazzcash', 'easypaisa'],
  sentinel: { enabled: true }
});

console.log(intent.client_secret); // Pass to frontend elements

Authentication

PPay uses API keys to authenticate requests. Your keys are available in the Dashboard. Keep secret keys server-side only.

Key TypePrefixUse For
Test Secretsk_test_Server-side API calls in Sandbox.
Test Publishablepk_test_Frontend SDK initialisation in Sandbox.
Live Keyssk_live_ / pk_live_Currently disabled pending launch.
Webhook Secretwhsec_Verify HMAC signatures on incoming events.

API Reference

POST /v1/payment_intents

Creates a PaymentIntent — the single source of truth for a payment attempt.

ParameterDescription
amount reqInteger. Amount in paisas. ₨4,999 = 499900.
currency reqString. Must be PKR.
payment_methods optArray of strings: card, jazzcash, easypaisa, raast. Defaults to all active methods.
sentinel optObject. {enabled: true} runs rule scoring.
POST /v1/sentinel/score

Score a transaction synchronously. Returns risk score and decision. Rules engine only (Phase 1).

ParameterDescription
amount_pkr reqInteger. Transaction amount in PKR.
customer_email reqString. Email (hashed before rule evaluation).
ip_address reqString. Customer IP for velocity/geo checks.

Webhooks

PPay sends signed HTTP POST requests to your endpoint. Verify the PPay-Signature header.

webhook_verify.js
const sig = req.headers['ppay-signature'];
const event = ppay.webhooks.constructEvent(
  req.body,
  sig,
  'whsec_test_secret'
);

if (event.type === 'payment.completed') {
  fulfillOrder(event.data.object);
}

Test Credentials

Use these credentials in sandbox mode. Any future expiry date and any CVV works.

4242 4242 4242 4242
Successful Visa payment
Success
4000 0000 0000 0002
Card declined — insufficient funds
Declined
4000 0000 0000 9995
Triggers Sentinel REVIEW decision
Review
0300-0000000
JazzCash — successful wallet payment
Success