What Happens Next?
- Invoice is created with status
not-paid - Customer automatically receives an email with the invoice
- Customer can pay via the
payment_link - You receive a
paymentrequest.successwebhook when payment completes - If unpaid by
due_date, status changes tooverdue(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: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.
