Skip to main content

Invoices API

Create professional invoices with automatic payment tracking and reminders. Perfect for B2B, services, and freelance billing.

Features

  • Professional Invoices - Generate branded, itemized invoices
  • Multiple Line Items - Products, services, discounts, taxes
  • Payment Tracking - Track paid, partial, and outstanding amounts
  • Auto Reminders - Automated payment reminders before/after due date
  • Crypto Payments - Accept USDC payments with on-chain tracking
  • PDF Generation - Downloadable invoice PDFs

Create Invoice

Create a new invoice with line items.

Endpoint

POST /api/v1/invoices

Request Parameters

ParameterTypeRequiredDescription
invoice_numberstringNoCustom invoice number (auto-generated if not provided)
customer_namestringYesCustomer or company name
customer_emailstringYesCustomer email for notifications
customer_walletstringNoCustomer's Solana wallet (for payments)
customer_addressobjectNoBilling address object
line_itemsarrayYesArray of line item objects
currencystringYesCurrency code ("USD" only)
due_datestringYesPayment due date (ISO 8601)
notesstringNoNotes to appear on invoice
termsstringNoPayment terms text
tax_ratenumberNoTax rate as percentage (e.g., 8.5 for 8.5%)
discount_amountnumberNoFixed discount amount
discount_percentnumberNoPercentage discount
send_emailbooleanNoSend invoice email immediately (default: true)
metadataobjectNoCustom key-value pairs

Line Item Object

FieldTypeRequiredDescription
descriptionstringYesItem description
quantitynumberYesQuantity
unit_pricenumberYesPrice per unit
tax_ratenumberNoItem-specific tax rate (overrides invoice tax)

Example: Service Invoice

curl -X POST https://api.zendfi.tech/api/v1/invoices \
-H "Authorization: Bearer zfi_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"invoice_number": "INV-2025-001",
"customer_name": "Acme Corporation",
"customer_email": "billing@acme.com",
"customer_wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"customer_address": {
"line1": "123 Business Ave",
"line2": "Suite 456",
"city": "San Francisco",
"state": "CA",
"postal_code": "94102",
"country": "US"
},
"line_items": [
{
"description": "Website Development - October 2025",
"quantity": 40,
"unit_price": 150
},
{
"description": "Hosting & Maintenance (Monthly)",
"quantity": 1,
"unit_price": 200
},
{
"description": "SSL Certificate (Annual)",
"quantity": 1,
"unit_price": 99
}
],
"currency": "USD",
"due_date": "2025-11-15T23:59:59Z",
"notes": "Thank you for your business!",
"terms": "Payment due within 30 days. Late payments subject to 1.5% monthly fee.",
"tax_rate": 8.5,
"send_email": true,
"metadata": {
"project": "website_redesign",
"contract_id": "contract_456"
}
}'

Response:

{
"id": "inv_abc123def456",
"merchant_id": "merchant_xyz789",
"invoice_number": "INV-2025-001",
"customer_name": "Acme Corporation",
"customer_email": "billing@acme.com",
"customer_wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"customer_address": {
"line1": "123 Business Ave",
"line2": "Suite 456",
"city": "San Francisco",
"state": "CA",
"postal_code": "94102",
"country": "US"
},
"line_items": [
{
"id": "li_001",
"description": "Website Development - October 2025",
"quantity": 40,
"unit_price": 150,
"amount": 6000
},
{
"id": "li_002",
"description": "Hosting & Maintenance (Monthly)",
"quantity": 1,
"unit_price": 200,
"amount": 200
},
{
"id": "li_003",
"description": "SSL Certificate (Annual)",
"quantity": 1,
"unit_price": 99,
"amount": 99
}
],
"subtotal": 6299,
"tax_rate": 8.5,
"tax_amount": 535.42,
"discount_amount": 0,
"total": 6834.42,
"amount_paid": 0,
"amount_due": 6834.42,
"currency": "USD",
"status": "sent",
"due_date": "2025-11-15T23:59:59Z",
"created_at": "2025-10-26T14:00:00Z",
"sent_at": "2025-10-26T14:00:01Z",
"payment_url": "https://zendfi.tech/invoice/inv_abc123def456/pay",
"pdf_url": "https://zendfi.tech/invoice/inv_abc123def456/pdf"
}

Get Invoice

Retrieve invoice details.

Endpoint

GET /api/v1/invoices/:id

Example

curl -X GET https://api.zendfi.tech/api/v1/invoices/inv_abc123def456 \
-H "Authorization: Bearer zfi_live_abc123..."

List Invoices

Get all invoices with optional filtering.

Endpoint

GET /api/v1/invoices

Query Parameters

ParameterTypeDescription
statusstringFilter by status
customer_emailstringFilter by customer email
from_datestringInvoices created after this date
to_datestringInvoices created before this date
overduebooleanOnly overdue invoices

Example

curl -X GET "https://api.zendfi.tech/api/v1/invoices?status=sent&overdue=true" \
-H "Authorization: Bearer zfi_live_abc123..."

Update Invoice

Update a draft or sent invoice. Cannot update paid invoices.

Endpoint

PATCH /api/v1/invoices/:id

Example: Add Line Item

curl -X PATCH https://api.zendfi.tech/api/v1/invoices/inv_abc123def456 \
-H "Authorization: Bearer zfi_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"line_items": [
{
"id": "li_001",
"description": "Website Development - October 2025",
"quantity": 40,
"unit_price": 150
},
{
"id": "li_002",
"description": "Hosting & Maintenance (Monthly)",
"quantity": 1,
"unit_price": 200
},
{
"id": "li_003",
"description": "SSL Certificate (Annual)",
"quantity": 1,
"unit_price": 99
},
{
"description": "Rush delivery fee",
"quantity": 1,
"unit_price": 250
}
]
}'

Send Invoice

Send or resend an invoice to the customer.

Endpoint

POST /api/v1/invoices/:id/send

Request Parameters

ParameterTypeRequiredDescription
messagestringNoCustom message to include in email
cc_emailsarrayNoAdditional email addresses to CC

Example

curl -X POST https://api.zendfi.tech/api/v1/invoices/inv_abc123def456/send \
-H "Authorization: Bearer zfi_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"message": "Please find attached invoice for October services.",
"cc_emails": ["accounts@acme.com"]
}'

Send Payment Reminder

Send a payment reminder for an outstanding invoice.

Endpoint

POST /api/v1/invoices/:id/remind

Example

curl -X POST https://api.zendfi.tech/api/v1/invoices/inv_abc123def456/remind \
-H "Authorization: Bearer zfi_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"message": "Friendly reminder: your invoice is due in 3 days."
}'

Record Payment

Manually record a payment received for an invoice.

Endpoint

POST /api/v1/invoices/:id/payments

Request Parameters

ParameterTypeRequiredDescription
amountnumberYesPayment amount
payment_methodstringNo"crypto", "bank_transfer", "check", "other"
referencestringNoPayment reference (tx signature, check number, etc.)
payment_datestringNoDate payment was received (defaults to now)
notesstringNoPayment notes

Example

curl -X POST https://api.zendfi.tech/api/v1/invoices/inv_abc123def456/payments \
-H "Authorization: Bearer zfi_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"amount": 6834.42,
"payment_method": "crypto",
"reference": "5K2Nz...abc123",
"notes": "Paid via USDC on Solana"
}'

Response:

{
"invoice_id": "inv_abc123def456",
"payment_id": "pmt_xyz789",
"amount": 6834.42,
"payment_method": "crypto",
"reference": "5K2Nz...abc123",
"payment_date": "2025-10-28T10:30:00Z",
"invoice_status": "paid",
"amount_due": 0
}

Mark as Void

Void an invoice. Voided invoices cannot be paid or edited.

Endpoint

POST /api/v1/invoices/:id/void

Example

curl -X POST https://api.zendfi.tech/api/v1/invoices/inv_abc123def456/void \
-H "Authorization: Bearer zfi_live_abc123..." \
-H "Content-Type: application/json" \
-d '{
"reason": "Duplicate invoice created in error"
}'

Invoice Statuses

StatusDescription
draftNot yet sent to customer
sentSent and awaiting payment
viewedCustomer viewed the invoice
partialPartially paid
paidFully paid
overduePast due date, unpaid
voidCancelled/voided

Automatic Reminders

ZendFi can automatically send payment reminders:

TimingTypeDescription
7 days beforeUpcomingFriendly reminder of upcoming due date
1 day beforeDue SoonPayment due tomorrow reminder
On due dateDue TodayDue date reminder
3 days afterOverdueFirst overdue notice
7 days afterOverdueSecond overdue notice
14 days afterFinalFinal payment notice

Configure automatic reminders in your merchant settings.


Webhook Events

EventDescription
invoice.createdInvoice created
invoice.sentInvoice sent to customer
invoice.viewedCustomer opened invoice
invoice.payment_receivedPayment received (full or partial)
invoice.paidInvoice fully paid
invoice.overdueInvoice became overdue
invoice.voidedInvoice voided

Example Webhook Payload

{
"event": "invoice.paid",
"timestamp": "2025-10-28T10:30:00Z",
"data": {
"invoice_id": "inv_abc123def456",
"invoice_number": "INV-2025-001",
"customer_name": "Acme Corporation",
"customer_email": "billing@acme.com",
"total": 6834.42,
"amount_paid": 6834.42,
"payment_method": "crypto",
"transaction_signature": "5K2Nz...abc123"
}
}

Invoice PDF

Generate and download a PDF version of the invoice.

Endpoint

GET /api/v1/invoices/:id/pdf

The PDF includes:

  • Your merchant branding (logo, company info)
  • Customer details and billing address
  • Itemized line items with quantities and prices
  • Subtotal, taxes, discounts, and total
  • Payment instructions and QR code
  • Terms and notes

Best Practices

Creating Invoices

  1. Clear Descriptions - Use specific item descriptions
  2. Reasonable Due Dates - 15-30 days is standard
  3. Include Terms - Set expectations for late payments
  4. Itemize Everything - Separate line items for transparency

Managing Payments

  1. Track Partials - Record partial payments as they come in
  2. Follow Up - Use reminders before invoices become overdue
  3. Reconcile Regularly - Match payments to invoices promptly
  4. Keep Records - Store payment references for accounting

Next Steps

Ask AI about the docs...