Invoicing
Create and send professional invoices to your customers.
1
What is Invoicing?
Invoicing allows you to send professional payment requests to customers. Customers can view the invoice and pay directly from the invoice page.
**Key Features:**
- Professional invoice templates
- Customizable line items and descriptions
- Payment tracking and status updates
- Send invoices via email or shareable link2
Creating an Invoice
Create an invoice by generating a checkout link with invoice details:
```typescript
await createCheckoutLink("biz_your_business_id", {
planName: "Website Development",
plan: "web-dev-invoice-001",
description: `
Invoice #001
Client: Acme Corporation
Date: March 15, 2024
Services:
- Homepage redesign: $500.00
- Contact form implementation: $200.00
- Mobile responsive fixes: $150.00
Total: $850.00
`.trim(),
price: "850.00",
billing: "one-time",
});
```
**Invoice Details:**
- `planName`: Invoice title or service name
- `plan`: Unique invoice identifier
- `description`: Full invoice details including line items
- `price`: Total amount due3
Sending Invoices
**Share Invoice Link Directly:**
```tsx
import Link from "next/link";
// Send customer to invoice page
<Link href="/checkout-links/plan_invoice001">
View Invoice
</Link>
```
**Email Invoice:**
Use your preferred email service to send the invoice link:
```typescript
import { Resend } from "resend";
const resend = new Resend(process.env.RESEND_API_KEY);
await resend.emails.send({
from: "invoices@yourcompany.com",
to: "customer@example.com",
subject: "Invoice #001 - $850.00 Due",
html: `
<h1>Invoice #001</h1>
<p>Dear Customer,</p>
<p>Please find your invoice attached.</p>
<p>Total: $850.00</p>
<a href="https://pay.yeld.app/plan_invoice001">
Pay Now
</a>
`,
});
```4
Invoice Tracking
Track invoice status through your dashboard or API:
```typescript
// Get invoice status
const invoice = await getCheckoutLinkByPlanId("plan_invoice001");
// Check if payment was received
const sessions = await db
.select()
.from(checkoutSessions)
.where(
and(
eq(checkoutSessions.checkoutLinkId, invoice.id),
eq(checkoutSessions.status, "confirmed")
)
);
const isPaid = sessions.length > 0;
```
**Invoice Statuses:**
- `pending`: Invoice created, awaiting payment
- `paid`: Payment confirmed
- `overdue`: Payment past due date (if applicable)Invoice Template Example
INVOICE
Invoice #: INV-2024-001
Date: March 15, 2024
Due: March 22, 2024
FROM:
Acme Web Services
contact@acmeweb.com
TO:
Client Name
client@example.com
DESCRIPTION QTY RATE AMOUNT
Homepage Redesign 1 $500.00 $500.00
Contact Form Impl. 1 $200.00 $200.00
Mobile Responsive Fixes 1 $150.00 $150.00
SUBTOTAL: $850.00
TOTAL: $850.00
Payment Methods:
- USDC on Base Sepolia
- [Pay Now Button]