S
ShadhinPay Docs

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 /invoices

Request Body

FieldTypeRequiredDescription
customer_namestringYesCustomer's name
customer_emailstringNoCustomer's email
customer_phonestringYesCustomer's phone number
itemsarrayYesArray of line items
due_datestringNoInvoice due date (ISO 8601)
notesstringNoAdditional notes
send_emailbooleanNoSend invoice via email

Line Item Object

FieldTypeRequiredDescription
descriptionstringYesItem description
quantitynumberYesQuantity
unit_pricenumberYesPrice per unit

Example Request

cURL
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

201 Created
{
  "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

200 OK
{
  "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 /invoices

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger20Items per page
statusstring-Filter by status

Send Invoice Reminder

Sends a payment reminder to the customer.

POST /invoices/{invoice_id}/remind

Example Response

200 OK
{
  "success": true,
  "message": "Reminder sent successfully"
}

Invoice Statuses

StatusDescription
DRAFTInvoice created but not sent
PENDINGInvoice sent, awaiting payment
PAIDInvoice has been paid
OVERDUEInvoice past due date
CANCELLEDInvoice was cancelled

On this page