Authentication
The API supports two authentication methods:
1. API Key (for external integrations & subsidiaries)
Pass your API key in the x-api-key header. API keys can be generated from the Dashboard under Payments & API.
2. Bearer Token (for dashboard/internal use)
Firebase Auth tokens for authenticated dashboard users.
Base URL
All API endpoints are relative to this base URL.
Record Payment
Record a payment directly via API key. Used by subsidiaries and external tools.
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| x-api-key | string | Required | Your API key |
| Content-Type | string | Required | application/json |
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| amount | number | Required | Payment amount in INR |
| type | string | incoming or outgoing (default: incoming) | |
| method | string | bank_transfer, cash, upi, cheque, other | |
| description | string | Payment description | |
| reference | string | External reference ID | |
| invoiceId | string | Link to an existing invoice (marks it as paid) | |
| metadata | object | Any additional metadata |
Response
Create Razorpay Order
Create a Razorpay order for payment capture. Returns the order ID and key for client-side checkout.
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| amount | number | Required | Amount in INR (e.g., 500.00) |
| currency | string | Currency code (default: INR) | |
| description | string | Order description | |
| customer | object | { name, email, phone } | |
| invoiceId | string | Link to invoice | |
| callbackUrl | string | URL to redirect after payment |
Response
Client-Side Integration
Create Payment Link
Generate a shareable Razorpay payment link. Optionally send it via email with a professional invoice template.
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| amount | number | Required | Amount in INR |
| description | string | Payment description | |
| customer | object | { name, email, phone } | |
| invoiceId | string | Link to existing invoice | |
| sendEmail | boolean | Send payment request email to customer |
Response
Razorpay Webhook
Configure this URL in your Razorpay Dashboard under Settings > Webhooks to receive automatic payment status updates.
payment.captured and payment_link.paid events. Updates payment records and linked invoices.https://akshaykotish.com/api/razorpay/webhook and select the events: payment.captured, payment_link.paid.
Create Invoice
Create a GST-compliant invoice with automatic tax calculations.
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| customer | object | Required | { name, email, phone, address, gstin, state } |
| items | array | Required | [{ description, hsn, qty, rate, gstRate }] |
| notes | string | Invoice notes | |
| dueDate | string | Due date (ISO format, default: 30 days) |
Response
List Invoices
Send Email
Send an email via the configured SMTP provider (Gmail, Brevo, or custom SMTP).
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| to | string | Yes | Recipient email address |
| subject | string | Yes | Email subject line |
| html | string | Yes | HTML body of the email |
| fromAlias | string | No | Send from a specific alias email address |
| fromName | string | No | Display name for the sender |
| attachments | array | No | Array of nodemailer attachment objects |
Example
Response
Email Invoice
Send a formatted invoice email to the customer. Automatically sends a payment receipt when invoice status is "paid".
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| reason | string | No | "payment_received" or "invoice_sent" (auto-detected from status) |
Note: Invoice emails are also sent automatically when:
- Invoice status is changed to "paid" via the dashboard
- Razorpay webhook receives a payment.captured or payment_link.paid event
- Razorpay checkout payment is verified via /razorpay/verify
Mail Configuration Status
Check which SMTP provider is configured and active.
Sent Emails History
Retrieve the last 50 sent emails with recipient, subject, type, and timestamp.
Query Parameters
| Param | Type | Description |
|---|---|---|
| limit | number | Max results (default: 50) |
Email Aliases
List all registered email aliases.
Register a new email alias.
Delete an email alias by its Firestore document ID.
Health Check
Error Handling
All errors return a JSON object with an error field:
HTTP Status Codes
| Code | Meaning |
|---|---|
| 200 | Success |
| 201 | Resource created |
| 400 | Bad request / validation error |
| 401 | Authentication failed |
| 403 | Insufficient permissions |
| 404 | Resource not found |
| 500 | Server error |