Invoices
Generate and send professional invoices with automatic payment collection
Invoices represent payment requests sent to customers. RevKeen automatically creates invoices for subscriptions, but you can also create manual invoices for one-time charges.
Invoice Lifecycle
| Status | Description | Actions |
|---|---|---|
draft | Being prepared, editable | Add items, finalize, delete |
open | Finalized, awaiting payment | Send, void, mark paid |
sent | Emailed to customer | Resend, void, mark paid |
paid | Fully paid | Issue refund |
partial | Partially paid | Send reminder |
overdue | Past due date | Send reminder, void |
void | Cancelled | — |
Creating Invoices
const invoice = await client.invoices.create({
customerId: 'cus_xxxxxxxx',
currency: 'USD',
dueDate: '2025-02-15T00:00:00Z',
// Line items
lineItems: [
{
description: 'Consulting - January 2025',
amountMinor: 50000, // $500.00
quantity: 1,
},
{
description: 'Travel expenses',
amountMinor: 15000, // $150.00
quantity: 1,
},
],
// Optional
memo: 'Thank you for your business!',
footer: 'Payment due within 30 days.',
});
console.log(invoice.data.invoiceNumber); // INV-2025-0001Sending Invoices
// Finalize and send invoice
const invoice = await client.invoices.finalize('inv_xxxxxxxx');
// Send via email
await client.invoices.send('inv_xxxxxxxx', {
to: ['john@example.com', 'billing@example.com'],
cc: ['accountant@yourcompany.com'],
});The invoice email includes a secure link where customers can view and pay online.
Adding Line Items
// Add a line item to a draft invoice
await client.invoices.addLineItem('inv_xxxxxxxx', {
description: 'Additional service',
amountMinor: 25000,
quantity: 1,
});
// Add from a product
await client.invoices.addLineItem('inv_xxxxxxxx', {
productId: 'prod_xxxxxxxx',
quantity: 2,
});Recording Payments
// Record an external payment (cash, check, etc.)
await client.invoices.pay('inv_xxxxxxxx', {
amountMinor: 65000,
paymentMethod: 'cash',
note: 'Paid via check #1234',
});
// Pay with saved card
await client.invoices.pay('inv_xxxxxxxx', {
paymentMethodId: 'pm_xxxxxxxx',
});Voiding Invoices
// Void an unpaid invoice
await client.invoices.void('inv_xxxxxxxx', {
reason: 'Duplicate invoice',
});Subscription Invoices
RevKeen automatically creates invoices for subscriptions:
- Created at start of each billing period
- Automatically finalized and charged
- Past due invoices trigger dunning emails
- Failed payments retry according to your retry schedule
// List invoices for a subscription
const invoices = await client.invoices.list({
subscriptionId: 'sub_xxxxxxxx',
});