Provides recurring billing for Drupal Commerce, powered by Advanced queue.
The successor to Commerce Recurring and Commerce License Billing for D7.
Features:
- Configurable billing intervals (charge every N days/weeks/months/years).
- Fixed and rolling interval types (charge on the 1st of the month VS 1 month from the subscription date)
- Prepaid and postpaid payment types (charge at the beginning or at the end of the billing cycle).
- Free trial of any interval (14 days followed by a regular monthly subscription, etc)
- Prorating (adjusting the charged price based on the duration of its usage)
- Usage tracking (track bandwidth and charge per GB, etc).
- Recurring membership (via commerce_license)
Prepaid billing for a license (usually of type "role").
- Recurring SaaS subscription
Postpaid billing, with optional usage, for a license.
- Donations
Prepaid billing for a product variation (no license). Customers can usually select between multiple billing schedules (monthly/yearly, etc).
Future use cases: Physical products (Dollar Shave Club, etc)
Each product variation represents a subscription plan and can be used to start a subscription. A product can have multiple variations, representing multiple plans the customer can choose from. For example, Basic and Premium memberships.
Each variation can have one or more billing schedules, which determine how the subscription will be billed (interval, interval type, payment type, free trial settings, etc).
On the add to cart form, the customer chooses a plan and a billing schedule (hidden if there's only 1 possible option), which are stored on the order item in the purchased_entity and billing_schedule fields. If the billing schedule dictates "postpayment" as the payment type, the initial unit price of the order item is 0.The customer provides their billing information and completes checkout. When the order is placed, a subscription is open for each order item with a specified billing_schedule. As soon as the subscription is activated, the billing schedule generates a billing cycle, and opens a recurring order for that billing cycle.
Once the billing cycle expires ($order->billing_cycle->end_date < time()), the module's hook_cron() implementation queues the order for closing and renewal. The queue worker then processes each order, collecting payment (via $subscription->payment_method), and opening the next recurring order.
The purchased entity (product variation, product bundle, etc). References N billing schedules and 1 subscription type.
Config entity + plugin (interval with number/unit, interval type, trial interval, payment type).
Generated by the billing schedule plugin. A value object with the following properties: index, start_date, end_date. Index '1' means this is the first billing cycle. Can be used by promotions to discount only the first N orders, or by the subscription itself to stop recurring after N cycles.