# Automatic Invoice Generation

This feature ensures that invoices are created and sent to clients based on the recurring billing cycle defined in the service settings. This automation streamlines the billing process and improves efficiency.

### **Benefits**

* **Consistency:** Invoices are generated and sent out consistently without manual intervention.
* **Efficiency:** Reduces the administrative burden of manual invoice creation.
* **Timely Payments:** Ensures clients receive timely invoices, improving cash flow.

### **Pre-conditions**

* **Active Subscription Configuration:** The service must be set up with a subscription payment plan.
* **Integrated Payment Gateway:** A payment gateway (e.g., Stripe, Paypal) must be configured to process payments.

### **Steps to Use**

1. **Configure Subscription Payment Plan**
   * Ensure that the service is set up with a subscription payment plan.
   * Define the billing cycle (day, week, month, or year) and pricing for the service.
2. **Automatic Invoice Creation**
   * **Self-Checkout Clients:** At the beginning of each billing cycle, invoices with a paid status are automatically generated for self-checkout clients.
   * **Manual Orders:** For manually created orders, invoices must be created manually for the first time. After that, it is automatically generated and sent to clients according to the predefined billing cycles.
3. **Payment Failure Handling**
   * **Open Status:** If a payment fails, the invoice remains open.
   * **No New Order:** No new order is created until the payment issue is resolved.
   * **Notifications:** Both the client and the agency receive notifications about the payment failure. The client is informed about the issue, and the agency is notified to take necessary actions.

### **Important Notes**

* **Invoice Status:** Ensure the invoice status is monitored to track successful and failed payments.
* **Error Handling:** In case of any errors, once resolved, the system should automatically calculate any backlog and generate the necessary invoices or orders.
* **Handling Different Billing Cycles:** Please take note of the following information:
  * Orders and invoices may have different billing cycles. For example, a subscription might begin on June 1 with a monthly billing cycle. If a manual invoice is created on June 3, the next order is scheduled for July 1, and the subsequent invoice will be generated on July 3.
  * After the first manual invoice, subsequent invoices are generated automatically.
  * Invoices repeat if the status is “Open” or “Paid.”
  * If an error occurs and prevents the creation of a new order/invoice, it will be recalculated and created once the error is fixed.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agencyhandy.com/english/agencyhandy-user-guide-for-agency/subscription/automatic-invoice-generation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
