NEXT GEN PAYON API Documentation
Integrate with our powerful payroll API to automate salary disbursements, manage employee data, ensure tax compliance, and generate reports.
Getting Started
Overview
The NEXT GEN PAYON API allows you to integrate our payroll processing capabilities directly into your applications. Our RESTful API provides endpoints for managing employees, processing payments, handling tax compliance, and generating reports.
Quick Start
Get up and running with our API in minutes with our step-by-step guide.
API Reference
Detailed documentation for all available endpoints, parameters, and responses.
Sample Code
Ready-to-use code examples in multiple programming languages.
Base URL
All API requests should be made to the following base URL:
https://api.nextgenpayon.com/v1
API Environments
We provide both sandbox and production environments. Use the sandbox for testing before going live.
Sandbox:
https://sandbox-api.nextgenpayon.com/v1
Production:
https://api.nextgenpayon.com/v1
Authentication
API Keys
All requests to the NEXT GEN PAYON API must be authenticated using API keys. You can generate and manage your API keys from the Developer Dashboard.
Security Notice
Keep your API keys secure and never share them in public repositories or client-side code. Rotate your keys periodically for enhanced security.
API Key Authentication
Include your API key in the request headers as follows:
GET /employees Authorization: Bearer YOUR_API_KEY Content-Type: application/json
Generating API Keys
To generate a new API key:
- Log in to your NEXT GEN PAYON dashboard
- Navigate to Developer Settings > API Keys
- Click "Generate New API Key"
- Set permissions and expiration (optional)
- Store your API key securely as it will only be shown once
API Key Types
Key Type | Permissions | Recommended Use |
---|---|---|
Public Key | Read-only access to non-sensitive data | Client-side applications, status checks |
Secret Key | Full access to all API endpoints | Server-side applications only |
Webhook Key | Used to verify webhook signatures | Webhook verification |
Payroll Processing
Bulk Payouts
POSTProcess multiple payments in a single API call. This endpoint allows you to disburse salaries to multiple employees simultaneously.
Endpoint
POST /payouts/bulk
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
batch_id | string | Yes | A unique identifier for the batch |
description | string | No | A description for the batch payment |
payments | array | Yes | Array of payment objects |
scheduled_date | string (ISO 8601) | No | Date to process the payments (defaults to immediate) |
Example Request
{ "batch_id": "BATCH-2025051701", "description": "May 2025 Salary Disbursement", "payments": [ { "employee_id": "EMP001", "amount": 85000.00, "currency": "INR", "description": "May 2025 Salary" }, { "employee_id": "EMP002", "amount": 110000.00, "currency": "INR", "description": "May 2025 Salary" } ], "scheduled_date": "2025-05-25T00:00:00Z" }
Example Response
{ "status": "success", "batch_id": "BATCH-2025051701", "transaction_id": "TXN-20250517-89721", "scheduled_date": "2025-05-25T00:00:00Z", "total_amount": 195000.00, "currency": "INR", "payment_count": 2, "payments": [ { "employee_id": "EMP001", "payment_id": "PAY-20250517-001", "status": "scheduled", "amount": 85000.00 }, { "employee_id": "EMP002", "payment_id": "PAY-20250517-002", "status": "scheduled", "amount": 110000.00 } ] }
Try It Out
Test the Bulk Payouts API
Response
Status: 200 OK{ "status": "success", "batch_id": "BATCH-TEST-001", "transaction_id": "TXN-TEST-12345", "scheduled_date": "2025-05-17T00:00:00Z", "total_amount": 5000.00, "currency": "INR", "payment_count": 1, "payments": [ { "employee_id": "EMP001", "payment_id": "PAY-TEST-001", "status": "scheduled", "amount": 5000.00 } ] }
Payment Status
GETRetrieve the status of a payment or batch of payments.
Endpoint
GET /payouts/{batch_id}
Path Parameters
Parameter | Type | Required | Description |
---|---|---|---|
batch_id | string | Yes | The unique identifier for the batch |
Example Response
{ "batch_id": "BATCH-2025051701", "status": "processing", "created_at": "2025-05-17T10:30:00Z", "scheduled_date": "2025-05-25T00:00:00Z", "total_amount": 195000.00, "currency": "INR", "payment_count": 2, "completed_count": 0, "failed_count": 0, "pending_count": 2, "payments": [ { "employee_id": "EMP001", "payment_id": "PAY-20250517-001", "status": "pending", "amount": 85000.00, "estimated_completion": "2025-05-25T12:00:00Z" }, { "employee_id": "EMP002", "payment_id": "PAY-20250517-002", "status": "pending", "amount": 110000.00, "estimated_completion": "2025-05-25T12:00:00Z" } ] }
Payment Status Codes
Status | Description |
---|---|
pending | Payment has been queued but not yet processed |
processing | Payment is currently being processed |
completed | Payment has been successfully processed |
failed | Payment processing failed |
cancelled | Payment was cancelled before processing |
scheduled | Payment is scheduled for future processing |
Webhooks
Webhook Events
Webhooks allow your application to receive real-time notifications about events that occur in your NEXT GEN PAYON account. Instead of polling our API for changes, webhooks will push notifications to your specified endpoint.
Available Events
Event | Description |
---|---|
payment.created | A new payment has been created |
payment.updated | A payment's status has been updated |
payment.completed | A payment has been successfully completed |
payment.failed | A payment has failed |
batch.created | A new batch of payments has been created |
batch.completed | A batch of payments has been completed |
employee.created | A new employee has been added |
employee.updated | An employee's information has been updated |
Setting Up Webhooks
To set up a webhook:
- Log in to your NEXT GEN PAYON dashboard
- Navigate to Developer Settings > Webhooks
- Click "Add Endpoint"
- Enter the URL where you want to receive webhook events
- Select the events you want to subscribe to
- Save your webhook configuration
Example Webhook Payload
{ "id": "evt_2025051712345", "created": "2025-05-17T14:23:45Z", "type": "payment.completed", "data": { "batch_id": "BATCH-2025051701", "payment_id": "PAY-20250517-001", "employee_id": "EMP001", "amount": 85000.00, "currency": "INR", "status": "completed", "completed_at": "2025-05-17T14:23:40Z", "description": "May 2025 Salary" } }
Verifying Webhook Signatures
To ensure that webhook events are coming from NEXT GEN PAYON, we sign all webhook requests with a signature that you can verify:
const crypto = require('crypto'); // Your webhook secret from the dashboard const webhookSecret = 'whsec_...'; function verifyWebhookSignature(payload, signature, timestamp) { const signedPayload = `${timestamp}.${payload}`; const expectedSignature = crypto .createHmac('sha256', webhookSecret) .update(signedPayload) .digest('hex'); return crypto.timingSafeEqual( Buffer.from(signature), Buffer.from(expectedSignature) ); } // Express.js example app.post('/webhook', (req, res) => { const signature = req.headers['x-nextgenpayon-signature']; const timestamp = req.headers['x-nextgenpayon-timestamp']; const payload = JSON.stringify(req.body); if (verifyWebhookSignature(payload, signature, timestamp)) { // Process the webhook console.log('Webhook verified:', req.body); res.status(200).send('Webhook received'); } else { console.error('Invalid webhook signature'); res.status(400).send('Invalid signature'); } });
SDKs & Libraries
Official SDKs
We provide official client libraries for several programming languages to make integrating with our API even easier.
Java
Install via Maven:
<dependency>
<groupId>com.nextgenpayon</groupId>
<artifactId>nextgenpayon-java</artifactId>
<version>1.0.0</version>
</dependency>
Example Usage
const NextGenPayon = require('nextgenpayon-node'); // Initialize the client with your API key const client = new NextGenPayon('YOUR_API_KEY'); // Create a bulk payout async function createBulkPayout() { try { const response = await client.payouts.createBulk({ batch_id: 'BATCH-2025051701', description: 'May 2025 Salary Disbursement', payments: [ { employee_id: 'EMP001', amount: 85000.00, currency: 'INR', description: 'May 2025 Salary' }, { employee_id: 'EMP002', amount: 110000.00, currency: 'INR', description: 'May 2025 Salary' } ], scheduled_date: '2025-05-25T00:00:00Z' }); console.log('Bulk payout created:', response); return response; } catch (error) { console.error('Error creating bulk payout:', error); throw error; } } // Check payment status async function checkPaymentStatus(batchId) { try { const response = await client.payouts.getBatch(batchId); console.log('Payment status:', response); return response; } catch (error) { console.error('Error checking payment status:', error); throw error; } } // Usage createBulkPayout() .then(response => checkPaymentStatus(response.batch_id)) .catch(error => console.error('Operation failed:', error));
Rate Limits
API Rate Limits
To ensure the stability and availability of our API, we apply rate limits to all API requests. Rate limits are applied on a per-API key basis.
Plan | Rate Limit | Burst Limit |
---|---|---|
Standard | 100 requests per minute | 150 requests |
Business | 300 requests per minute | 450 requests |
Enterprise | 1000 requests per minute | 1500 requests |
Rate Limit Headers
Each API response includes headers that provide information about your current rate limit status:
Header | Description |
---|---|
X-RateLimit-Limit | The maximum number of requests you're permitted to make per minute |
X-RateLimit-Remaining | The number of requests remaining in the current rate limit window |
X-RateLimit-Reset | The time at which the current rate limit window resets in UTC epoch seconds |
Rate Limit Exceeded
If you exceed the rate limit, you will receive a 429 Too Many Requests response with a JSON error body:
{ "error": { "code": "rate_limit_exceeded", "message": "Rate limit exceeded. Please try again in 23 seconds.", "type": "api_error" } }