跳到主要内容
版本:1.0.1

Invoices

Invoices are used to request payment from customers. Dimebia provides automated invoicing with support for multiple currencies, tax calculation, and payment tracking.

Overview

An invoice is a document requesting payment for goods or services. Dimebia invoices can be:

  • One-time: Single payment invoices
  • Recurring: Generated automatically for subscriptions
  • Proforma: Estimates before final invoice

Create an Invoice

POST /api/invoice/create

Request Body

FieldTypeRequiredDescription
customerIdLongYesCustomer ID
dueDateStringYesDue date (YYYY-MM-DD)
itemsArrayYesInvoice line items
taxRateIntegerNoTax rate percentage (0-100)
currencyStringNoCurrency code (default: USD)
notesStringNoAdditional notes

Line Item Structure

{
"description": "Premium Plan - Monthly",
"quantity": 1,
"unitPrice": 9900,
"amount": 9900
}

Example

curl -X POST http://localhost:8080/api/invoice/create \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-d '{
"customerId": 1,
"dueDate": "2026-09-01",
"currency": "USD",
"taxRate": 10,
"items": [
{
"description": "Premium Plan - Monthly",
"quantity": 1,
"unitPrice": 9900,
"amount": 9900
}
],
"notes": "Thank you for your business"
}'

Invoice Status

StatusDescription
DRAFTInvoice is being prepared
SENTInvoice sent to customer
VIEWEDCustomer viewed the invoice
PAIDPayment received
OVERDUEPast due date, unpaid
CANCELLEDInvoice cancelled

Invoice Numbering

Invoices follow a sequential numbering pattern:

  • Format: INV-YYYYMMDD-XXXX
  • Example: INV-20260818-0001

Tax Calculation

Dimebia automatically calculates tax based on:

  • Customer location (billing address)
  • Product/service type
  • Current tax rates

See Tax Guide for detailed tax configuration.

Payment Tracking

Track invoice payments through the transaction system:

GET /api/invoice/{id}/payments

Code Examples

Node.js

const invoice = await client.invoices.create({
customerId: 1,
dueDate: '2026-09-01',
items: [
{
description: 'Premium Plan',
quantity: 1,
unitPrice: 9900,
},
],
taxRate: 10,
});