Billing Events
A billing has four statuses, and they change according to actions from the bills or the order.
Waiting payment
In the case of waiting_payment, it occurs when a billing is created and is awaiting the customer to pay the first installment.
Active
It happens when a payment is captured on one of its bills (normally the first installment) and the order has no other active or finished billing, or in cases of database import, they are already marked as active. A renegotiation billing (origin_billing_id set) is active as soon as it is created.
Finished
It occurs when all the bills in the billing are marked as paid.
Canceled
Is the only one where the action can come from either the order or the bill. In cases of cancellation without a refund, the order is canceled, and then we cancel the billing and the unpaid bills. In cases of cancellation with a refund, the billing is canceled after the payment refund is completed, check the cancelation_reason field for more details.