Invoices API
Create and manage invoices with the ShadhinPay API
Invoices API
The Invoices API allows you to create professional invoices and send them to customers.
Create Invoice
Creates a new invoice and optionally sends it to the customer.
POST /invoicesRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
customer_name | string | Yes | Customer's name |
customer_email | string | No | Customer's email |
customer_phone | string | Yes | Customer's phone number |
items | array | Yes | Array of line items |
due_date | string | No | Invoice due date (ISO 8601) |
notes | string | No | Additional notes |
send_email | boolean | No | Send invoice via email |
Line Item Object
| Field | Type | Required | Description |
|---|---|---|---|
description | string | Yes | Item description |
quantity | number | Yes | Quantity |
unit_price | number | Yes | Price per unit |
Example Request
curl -X POST https://api.shadhinpay.com/api/v1/invoices \
-H "Content-Type: application/json" \
-H "Client-Id: your_client_id" \
-H "Business-Id: your_business_id" \
-H "Secret-Key: your_secret_key" \
-d '{
"customer_name": "Jane Smith",
"customer_email": "jane@example.com",
"customer_phone": "8801712345678",
"items": [
{
"description": "Web Development Service",
"quantity": 1,
"unit_price": 50000
},
{
"description": "Hosting (1 year)",
"quantity": 1,
"unit_price": 5000
}
],
"due_date": "2024-02-01",
"notes": "Thank you for your business!",
"send_email": true
}'Example Response
{
"success": true,
"message": "Invoice created successfully",
"data": {
"invoice_id": "INV-2024-001",
"invoice_number": "INV-2024-001",
"status": "PENDING",
"customer_name": "Jane Smith",
"subtotal": 55000,
"total": 55000,
"currency": "BDT",
"due_date": "2024-02-01",
"payment_url": "https://pay.shadhinpay.com/invoice/INV-2024-001",
"created_at": "2024-01-15T10:00:00Z"
}
}Get Invoice
Retrieves details of a specific invoice.
GET /invoices/{invoice_id}Example Response
{
"success": true,
"data": {
"invoice_id": "INV-2024-001",
"invoice_number": "INV-2024-001",
"status": "PAID",
"customer_name": "Jane Smith",
"customer_email": "jane@example.com",
"items": [
{
"description": "Web Development Service",
"quantity": 1,
"unit_price": 50000,
"total": 50000
},
{
"description": "Hosting (1 year)",
"quantity": 1,
"unit_price": 5000,
"total": 5000
}
],
"subtotal": 55000,
"total": 55000,
"currency": "BDT",
"due_date": "2024-02-01",
"paid_at": "2024-01-20T15:30:00Z",
"payment_id": "SP_9876543210"
}
}List Invoices
GET /invoicesQuery Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
page | integer | 1 | Page number |
limit | integer | 20 | Items per page |
status | string | - | Filter by status |
Send Invoice Reminder
Sends a payment reminder to the customer.
POST /invoices/{invoice_id}/remindExample Response
{
"success": true,
"message": "Reminder sent successfully"
}Invoice Statuses
| Status | Description |
|---|---|
DRAFT | Invoice created but not sent |
PENDING | Invoice sent, awaiting payment |
PAID | Invoice has been paid |
OVERDUE | Invoice past due date |
CANCELLED | Invoice was cancelled |