REST APIs, webhooks, and SDKs for Node.js, Python, PHP, Java, and more. Integrate in minutes.
API key-based auth using HTTP Basic Auth. Test and live keys available separately.
Standard JSON over HTTPS. All endpoints return predictable, consistent response formats.
Real-time event notifications for payment success, failure, refunds, and chargebacks.
Official SDKs for Node.js, Python, PHP, Java, Go, .NET, and mobile (iOS/Android).
Choose your language and install the ZingPay SDK.
# Install via npm
npm install zingpay-node
# Install via pip
pip install zingpay
# Install via composer
composer require zingpay/zingpay-php
Create an order on your server before showing the checkout to your customer.
const ZingPay = require('zingpay-node');
const client = new ZingPay({
apiKey: 'zp_live_YOUR_API_KEY',
apiSecret: 'YOUR_API_SECRET'
});
const order = await client.orders.create({
amount: 49900, // Amount in paise (₹499.00)
currency: 'INR',
receipt: 'order_rcpt_001',
notes: {
product_id: 'PRD_001',
customer_email: '[email protected]'
}
});
console.log(order.id); // order_KFsX8BLVI...
import zingpay
client = zingpay.ZingPay(
api_key="zp_live_YOUR_API_KEY",
api_secret="YOUR_API_SECRET"
)
order = client.orders.create(
amount=49900, # Amount in paise (₹499.00)
currency="INR",
receipt="order_rcpt_001"
)
print(order["id"]) # order_KFsX8BLVI...
curl -u zp_live_YOUR_API_KEY:YOUR_API_SECRET \
-X POST https://api.zingpay.online/v1/orders \
-H "Content-Type: application/json" \
-d '{
"amount": 49900,
"currency": "INR",
"receipt": "order_rcpt_001"
}'
Load the ZingPay checkout JS and pass the order ID. That's it.
<!-- Include the ZingPay Checkout script -->
<script src="https://checkout.zingpay.online/v2/checkout.js"></script>
<script>
const options = {
key: "zp_live_YOUR_API_KEY",
amount: 49900,
currency: "INR",
name: "Your Business",
description: "Order #001",
order_id: "order_KFsX8BLVI...", // from server
prefill: {
name: "Customer Name",
email: "[email protected]"
},
theme: { color: "#6C47FF" },
handler: function(response) {
// Verify payment on your server
verifyPayment(response.payment_id);
}
};
const zp = new ZingPay(options);
zp.open();
</script>
ZingPay sends signed webhooks for every payment event. Verify the signature to prevent fraud.
const express = require('express');
const ZingPay = require('zingpay-node');
const app = express();
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
const sig = req.headers['x-zingpay-signature'];
const webhookSecret = 'YOUR_WEBHOOK_SECRET';
try {
const event = ZingPay.webhooks.verify(req.body, sig, webhookSecret);
switch(event.type) {
case 'payment.success':
// Fulfill the order
fulfillOrder(event.data.order_id);
break;
case 'payment.failed':
// Notify the customer
notifyFailure(event.data.order_id);
break;
case 'refund.processed':
// Update refund status
updateRefund(event.data.refund_id);
break;
}
res.json({ received: true });
} catch(err) {
res.status(400).send(`Webhook Error: ${err.message}`);
}
});
from flask import Flask, request, jsonify
import zingpay
app = Flask(__name__)
@app.route('/webhook', methods=['POST'])
def webhook():
sig = request.headers.get('X-ZingPay-Signature')
payload = request.get_data()
secret = 'YOUR_WEBHOOK_SECRET'
try:
event = zingpay.webhooks.verify(payload, sig, secret)
if event['type'] == 'payment.success':
fulfill_order(event['data']['order_id'])
elif event['type'] == 'payment.failed':
notify_failure(event['data']['order_id'])
return jsonify({'received': True})
except Exception as e:
return str(e), 400
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/orders |
Create a new payment order |
| GET | /v1/orders/:id |
Fetch order details by ID |
| GET | /v1/payments/:id |
Fetch payment details |
| POST | /v1/payments/:id/capture |
Capture an authorized payment |
| POST | /v1/refunds |
Initiate a full or partial refund |
| GET | /v1/refunds/:id |
Fetch refund status |
| POST | /v1/payouts |
Initiate a payout to a bank account |
| POST | /v1/subscriptions |
Create a recurring subscription plan |
| GET | /v1/settlements |
List all settlements for a period |
npm i zingpay-node
pip install zingpay
composer require zingpay/php
Maven / Gradle
WordPress Plugin
Shopify App Store
Gradle dependency
Swift Package Manager