Invoices
Professional invoicing · Line items & tax · PDF generation · One-time & recurring payments
Summary
Invoices allow merchants to send itemized bills to customers with automatic payment link or subscription creation. When an invoice is created, RapidCents generates a PDF, sends it to the customer via email, and creates a Payment Link (one-time) or Subscription (recurring) for the customer to complete payment.
Invoices support line items, tax, discounts (percentage or fixed), due dates, auto-expiry, and recurring billing via linked subscriptions. The invoice status automatically updates to PAID when the linked payment is completed.
Invoice Lifecycle
- Create — Merchant creates an invoice with line items, customer, total, tax, discount, and payment type. A Payment Link or Subscription is automatically created.
- Send — RapidCents sends the invoice email to the customer with a PDF attachment and a “Pay Now” button.
- Pay — Customer clicks the payment link and completes payment through the hosted payment page. The invoice status automatically updates to
PAID. - Resend — Merchant can resend the invoice email at any time.
Invoice Statuses
PENDING
Invoice created and sent. Awaiting customer payment.
PAID
Payment received. Automatically set when the linked Payment Link is paid.
REFUNDED
Payment has been refunded to the customer.
PARTIALLY_PAID
Partial payment received (applicable for installment plans).
Processing Flow
One-Time Payment
Recurring Payment (Subscription / Installment)
Authentication
All invoice endpoints require a valid Bearer token and are scoped to a business:
Authorization: Bearer {access_token}
Content-Type: application/json
Base URL pattern: /api/{business_id}/invoices
Create Invoice
POST /api/{business}/invoices
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
customerId | string (UUID) | Yes | Customer to receive the invoice |
items | array | Yes | Line items (see Line Items) |
total | number | Yes | Total invoice amount (min: 0.01) |
subTotal | number | Yes | Subtotal before tax and discount |
dueDate | date | Yes | Invoice due date |
notes | string | No | Additional notes (max 1000 characters) |
tax | number | No | Tax percentage (e.g. 13 for 13%) |
discount | number | No | Discount value (percentage or fixed amount) |
isDiscountPercentage | boolean | No | true = discount is a percentage, false = fixed dollar amount. Default: true |
expireOnDue | boolean | No | Expire the payment link when the due date passes |
customInvoiceNumber | string | No | Custom invoice number |
threeDSecure | boolean | No | Enable 3D Secure. Default: true |
paymentInfo | object | Yes | Payment configuration (see below) |
Payment Info Object
| Field | Type | Required | Description |
|---|---|---|---|
paymentType | string | No | 1 = One-time Payment Link (default), 2 = Subscription, 3 = Installment |
merchant_description | string | Yes | Payment description |
sequence | integer | If type 2 | Billing frequency (1–6) |
startDate | date | If type 2 or 3 | First charge date |
numberOfBills | integer | If type 3 | Number of installments (min: 1) |
endDate | date | No | Subscription end date |
POST /api/{business}/invoices
Content-Type: application/json
Authorization: Bearer {token}
{
"customerId": "customer-uuid",
"items": [
{
"name": "Web Development",
"description": "Frontend implementation",
"quantity": 10,
"price": 150.00
},
{
"name": "SSL Certificate",
"quantity": 1,
"price": 49.99
}
],
"subTotal": 1549.99,
"tax": 13,
"discount": 10,
"isDiscountPercentage": true,
"total": 1574.49,
"dueDate": "2026-03-15",
"expireOnDue": true,
"notes": "Thank you for your business!",
"paymentInfo": {
"paymentType": "1",
"merchant_description": "Invoice for web development services"
}
}
{
"ok": true,
"message": "Invoice created successfully",
"invoice": {
"id": "invoice-uuid",
"invoice_number": "INV-20260219-0001",
"status": "PENDING",
"total": 1574.49,
"payment_link_id": "payment-link-uuid",
"created_at": "2026-02-19T12:00:00.000000Z"
}
}
List Invoices
GET /api/{business}/invoices
Returns a paginated list of invoices with optional date filters.
{
"ok": true,
"invoices": {
"data": [ /* array of invoice objects */ ],
"current_page": 1,
"per_page": 10,
"total": 25
},
"filters": { "fromDate": null, "toDate": null }
}
Get Invoice
GET /api/{business}/invoices/{invoice}
Returns the full details of a single invoice.
Update Invoice
PUT /api/{business}/invoices/{invoice}
Updates an existing invoice. Only editable if the linked payment has not been completed and no active subscription exists.
Delete Invoice
DELETE /api/{business}/invoices/{invoice}
Deletes an invoice along with its linked Payment Link or Subscription. Only deletable if the linked payment has not been completed.
{
"ok": true,
"message": "Invoice deleted successfully"
}
Resend Invoice
POST /api/{business}/invoices/{invoice}/resend
Re-sends the invoice email to the customer with the PDF attachment and payment link.
{
"ok": true,
"message": "Invoice resent successfully"
}
Export Invoices
GET /api/{business}/invoices/export
Returns all invoices matching the filter criteria in a JSON format suitable for spreadsheet export.
Line Items
Each invoice must contain at least one line item. Items are stored as JSON within the invoice.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Item name (max 255 characters) |
description | string | No | Item description (max 1000 characters) |
quantity | number | Yes | Quantity (min: 1) |
price | number | Yes | Unit price (min: 0) |
The PDF invoice displays line items in a table with columns: Name, Quantity, Unit Price, and Total (quantity × price).
Tax & Discount
Tax
The tax field represents a percentage applied to the subtotal. For example, a tax value of 13 means 13% tax.
// Tax calculation
tax_amount = sub_total × (tax / 100)
Discount
Discounts can be either percentage-based or a fixed dollar amount, controlled by the isDiscountPercentage field:
| isDiscountPercentage | Discount Value | Calculation |
|---|---|---|
true (default) | 10 | 10% off the subtotal |
false | 50 | $50 off the subtotal |
Payment Types
| Type | Value | Description | Linked Entity |
|---|---|---|---|
| One-time | 1 (default) | Customer pays the full amount at once via Payment Link | Payment Link |
| Subscription | 2 | Recurring charges at the specified frequency | Subscription |
| Installment | 3 | Fixed number of equal payments | Subscription (with installment count) |
For subscription and installment types, the invoice is linked to a Subscription. The customer receives an email directing them to the subscription activation page where they enter card details.
Due Dates & Expiry
dueDate— Required. The date by which payment is expected.expireOnDue— Optional. When set totrue, the linked Payment Link will automatically expire when the due date passes, preventing further payment.
There is no automatic “overdue” status. Overdue invoices remain in PENDING status. Use the expireOnDue flag to enforce payment deadlines.
PDF Generation
When an invoice is created, RapidCents automatically generates a PDF document containing:
- Business logo and legal name
- Invoice number and date
- Customer details
- Line items table (Name, Quantity, Unit Price, Total)
- Subtotal, tax, discount, and grand total
- Due date
- Notes (if provided)
The PDF is attached to the customer notification email and can be downloaded from the merchant dashboard.
All Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/{business}/invoices | List invoices |
| POST | /api/{business}/invoices | Create invoice |
| GET | /api/{business}/invoices/{id} | Get invoice details |
| PUT | /api/{business}/invoices/{id} | Update invoice |
| DELETE | /api/{business}/invoices/{id} | Delete invoice |
| POST | /api/{business}/invoices/{id}/resend | Resend invoice |
| GET | /api/{business}/invoices/export | Export invoices |
Notifications
| Event | Recipient | Subject | Content |
|---|---|---|---|
| Invoice created / resent | Customer | Your invoice details | PDF invoice attachment with a “Pay Now” button linking to the Payment Link or Subscription page |
The “Pay Now” link in the email directs to:
- One-time:
/customer/payment_links/{payment_link_id} - Subscription/Installment:
/customer/recurring_payments/{subscription_id}
Error Handling
| HTTP Code | Scenario | Description |
|---|---|---|
422 | Validation error | Missing required fields, invalid data, or total below 0.01 |
404 | Not found | Invoice does not exist |
409 | Cannot delete | Invoice cannot be deleted because the linked payment has been completed |
500 | Server error | Unexpected processing error |