Skip to main content
Let’s create a simple invoice for a monthly subscription:

What Happens Next?

  1. Invoice is created with status not-paid
  2. Customer automatically receives an email with the invoice
  3. Customer can pay via the payment_link
  4. You receive a paymentrequest.success webhook when payment completes
  5. If unpaid by due_date, status changes to overdue (production only)

Create a Professional Invoice

For detailed billing with line items (perfect for usage-based subscriptions):

Line Item Breakdown

The invoice automatically calculates:
  • Subtotal: Sum of all line items (500 + [50 * 0.50] = 500 + 25 = 525)
  • Discount: 10% off subtotal (525)
  • Total: Subtotal minus discount (472.5)

Work with Drafts

Create a draft invoice to review before sending:
Draft invoices are not sent to customers and have sent_date: null. Use sendDraftInvoice() to publish them.

Check Invoice Status

Retrieve an invoice to check its current status:

List All Invoices

Fetch invoices with pagination:

Send Payment Reminders

Remind customers about unpaid invoices:
The system tracks reminder_count to prevent spam. Use reminders judiciously.

Handle Webhooks

Set up webhook handling to respond to invoice events:
Always return a 200 status code to acknowledge receipt of webhooks.

Subscription Use Case Example

Here’s a complete monthly subscription flow:

Common Questions

Q: When is the invoice sent to the customer?
A: Immediately upon creation (for published invoices) or when you call sendDraftInvoice() for drafts.
Q: How do I know when an invoice is paid?
A: You’ll receive a paymentrequest.success webhook event. You can also poll using retrieve().
Q: What happens if a customer doesn’t pay by the due date?
A: In production mode, the invoice status automatically changes to overdue and you receive an invoice.overdue webhook.
Q: Can I manually mark an invoice as paid?
A: Yes, use modempay.invoices.pay(id) for offline payments.

Need help? Contact support at info@modempay.com.