Create a Scheduled Invoice

Sets up a recurring or one-time schedule to generate invoices automatically based on specified parameters. This endpoint provides flexibility for creating automated billing workflows.




Key Features

  • Creates a schedule to generate invoices at specified intervals using recurrence rules.
  • Supports optional autopay functionality by attaching a payment_method_id.
  • Automatically recalculates the next_run_at time after each generated invoice or payment.
  • Enables merchants to include metadata like tax, subtotal, and lineItems for enhanced invoice detail.
  • Allows merchants to control email notifications for generated invoices.

Usage Notes

Recurring Rules

The rule parameter follows the iCalendar RRule specification. Examples include:

  • Monthly Recurrence: DTSTART=20231101T120000Z;FREQ=MONTHLY
  • Weekly Recurrence Until a Specific Date: DTSTART=20231101T120000Z;FREQ=WEEKLY;UNTIL=20231231T000000Z;INTERVAL=1

Autopay

  • If payment_method_id is included, payments will be attempted automatically when invoices are generated.
  • If no payment_method_id is included, customers can manually enter payment details when paying the invoice.

Email Notifications

  • By default, email_notification is set to true to send emails automatically when invoices are generated.
  • Set email_notification=false to disable automatic email notifications.

Pausing and Resuming

  • Pause a schedule using PUT /invoice/schedule/{id} and set active=false. This will clear the next_run_at date.
  • To resume, set active=true and provide a future DTSTART.

Response Structure

CodeResponseReason
201Schedule CreatedThe schedule was successfully created.
400Bad RequestInvalid parameters or missing required fields.
422Validation ErrorDTSTART is in the past, or recurrence rules are incorrectly formatted.
500Internal Server ErrorUnexpected server error.

Important Considerations

  • Metadata and Emails: Populate meta fields such as subtotal, tax, and lineItems to include these details in email notifications and invoices.
  • Future Start Dates: DTSTART must be a future date; past dates are invalid.
  • Automatic Recalculation: The next_run_at time is recalculated each time an invoice is generated or paid.
  • Audit Trail: Each generated invoice includes timestamps and payment details for reporting purposes.
  • Invoice Lifecycle: If paused, the schedule will not generate invoices until resumed with a valid future DTSTART.
Language
Credentials
OAuth2
Click Try It! to start a request and see the response here!