> ## Documentation Index
> Fetch the complete documentation index at: https://docs.unibee.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscription auto-charge workflow

<img src="https://mintcdn.com/aaaabmero/PAQKVjj86U1Qa7E1/images/subscription-diagram.png?fit=max&auto=format&n=PAQKVjj86U1Qa7E1&q=85&s=4861b70837a47106c84527b5611fa996" alt="subscription diagram" width="1848" height="1770" data-path="images/subscription-diagram.png" />

Subscription Auto-Charge will run for every subscription which status in active or incomplete and its advanceTime(only run on development environment) not enabled

* 3 days before sub due time: Create First Auto-Charge Invoice #1(Payment and Gateway charge will not create at this time)
* 2 hours before sub due time: Create First Auto-Charge Payment Based on the Invoice #1(Gateway charge start)
  * Ahead of sub due time that give gateway to finish the Auto-Charge
* Every 12 hours: Cancel Last Auto-Charge Invoice\&Payment And Create New Invoice\&Payment
* Half an hour before sub due time: Stop Create New Invoice\&Its Payment
* Due time: Subscription Expired & Cancel All unfinished Invoice & Payment

When the Auto-Charge invoice and its payment is success, Auto-Charge will success and the subscription will goes to next billing cycle
