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

# Postpaid Invoices

> Understand how invoices are generated, reviewed, approved, and collected for postpaid subscriptions.

A **postpaid subscription** allows a customer to use a service during the billing period and pay for it after the billing period ends.

In Transact Bridge, the recurring amount is **not collected at the beginning of the billing period**. Instead, an invoice is generated after the billing period based on the configured billing model, contract, or actual usage.

## How Postpaid Invoices Work

The postpaid invoice flow in Transact Bridge follows these steps:

1. The merchant creates a subscription with `billAtStart: false`.
2. The subscription enters the `PENDING` state.
3. The customer completes the hosted checkout and authorizes a payment method, such as a UPI AutoPay mandate or card mandate.
4. After successful authorization, the subscription becomes `ACTIVE`.
5. The customer uses the subscribed service during the billing period.
6. At the end of the billing cycle, Transact Bridge generates a draft invoice.
7. Transact Bridge sends a DRAFT Invoice [**webhook**](https://docs.transactbridge.com/#b688f88f-8d91-4890-85c7-1b0db62458df) to the merchant.
8. The merchant can review and update the  DRAFT invoice amount and line items based on actual usage or billing inputs by calling [Update Draft Invoice](https://docs.transactbridge.com/#d41f45ed-8581-423a-b96d-af54d339c0bf).
9. After updating the invoice, use [Approve Draft Invoice](https://docs.transactbridge.com/#7acd088e-1eb1-4056-94f3-d3050e69c517) to approve the invoice and make it available for the customer.
10. If no action is taken within the approval window, the invoice is automatically approved after 24 hours from the time of DRAFT invoice generation.
11. After approval, Transact Bridge attempts to collect the approved amount using the customer's saved payment mandate.
12. If payment succeeds, the subscription continues into the next billing cycle.
13. If payment fails, the configured retry, due, overdue, and unpaid-invoice policies are applied.

<Note>
  During mandate setup, a nominal authorization amount may be charged by the acquiring bank to verify the customer's payment details and authorize the payment mandate.
</Note>

## Postpaid Invoice Flow

```mermaid theme={null}
flowchart TD
    A[Create Subscription<br/>billAtStart: false]
    --> B[PENDING]

    B --> C[Hosted Checkout<br/>Payment Method Authorization]

    C --> D[ACTIVE]

    D --> E[Customer Uses Service]

    E --> F[Billing Cycle Ends]

    F --> G[Draft Invoice Generated]

    G --> H[Draft Invoice Webhook Sent]

    H --> I[Merchant Reviews Invoice]

    I --> J{Merchant Action<br/>Within Approval Window}

    J -->|Update and Approve| K[Invoice Approved]

    J -->|No Action| L[Auto-Approved]

    K --> M[Collection Attempt]

    L --> M

    M --> N{Payment Successful?}

    N -->|Yes| O[Next Billing Cycle]

    N -->|No| P[Retries / Due / Overdue<br/>or Subscription Action]

    P --> M
```

## Invoice Generation

For a postpaid subscription, the invoice is generated **after the customer has consumed the service for the billing period**.

For example, if the subscription has a monthly billing cycle:

```text theme={null}
1 August
   |
   | Customer uses service
   |
   |-----------------------------|
   |                             |
   |       August Usage          |
   |                             |
   |-----------------------------|
                                31 August
                                    |
                                    ↓
                              Invoice Generated
```

The invoice amount can be based on the applicable billing configuration and actual usage.

## Draft Invoice

Transact Bridge generates a **draft invoice** at the end of the billing cycle. A draft invoice allows the merchant to review and, where applicable, update the amount before collection.
Transact Bridge sends a **draft invoice webhook** to the merchant's configured server URL.
The merchant can use the information in the webhook to:

* Calculate charges based on actual usage.
* Update the invoice amount.
* Apply applicable billing adjustments.
* Approve the invoice for collection.

## Invoice Approval

After the draft invoice is generated, the merchant has an approval window to review and approve the invoice.

The merchant can:

```text theme={null}
Draft Invoice
      |
      ↓
Review Amount
      |
      ├── Update Amount
      |
      └── Approve Invoice
```

If the merchant does not take action within the configured approval window, the invoice is **automatically approved after 24hrs**. Once invoice is marked as APPROVED, Transact Bridge proceeds with payment collection.

## Payment Collection

After the invoice is approved, Transact Bridge attempts to collect the invoice amount using the customer's saved payment mandate.

```text theme={null}
Approved Invoice
       |
       ↓
Collection Attempt
       |
       ↓
Payment Successful?
     /       \
   Yes        No
   |           |
   ↓           ↓
Next Cycle   Retry / Due /
             Overdue Handling
```

If payment succeeds, the subscription continues normally. If payment fails, the configured retry, due, overdue, and unpaid-invoice policies are applied.

# Example: Cloud Service Subscription

Consider a customer subscribed to a monthly cloud service.

### Step 1: Subscription Creation and activation

The merchant creates the subscription with billAtStart": false and initial amount as ₹1,500. Subscription enters the `PENDING` state. The customer does not pay at the beginning of the billing period. Instead, the customer first authorizes a payment method buy making the payment of a nominal amount (₹2 for India). After successful authorization, the subscription becomes `ACTIVE`, and the customer can use the cloud service.

### Step 2: Customer Uses the Service

Assume the customer's billing period is **1<sup>st</sup> August – 1<sup>st</sup> September**. During that billing cycle, the customer uses cloud resources.

For example:

```text theme={null}
Compute usage       ₹1,500
Storage usage       ₹500
Data transfer       ₹300
--------------------------
Total usage         ₹2,300
```

the customer has used the service throughout August, but payment has not yet been collected.

### Step 3: Invoice Generation

At the end of the billing cycle that is on the midnight (UTC) of 31<sup>st</sup> August , Transact Bridge generates a draft invoice.

```text theme={null}
31 August
    |
    ↓
Billing Cycle Ends
    |
    ↓
Draft Invoice Generated
    |
    ↓
Draft Invoice Webhook
```

The draft invoice contains the applicable billing information. Where merchant can review the invoice and update the amount if the final usage calculation requires an adjustment.

### Step 4: Merchant Reviews the Invoice

Suppose the merchant reviews the customer's usage and determines that an additional total invoice that should be charged is ₹2,500.

The invoice can therefore be updated to:

```text theme={null}
Compute usage       ₹1,500
Storage usage       ₹500
Data transfer       ₹300
Additional usage    ₹200
                  ------
Final invoice     ₹2,500
```

The merchant then mark the invoice as APPROVED.

```text theme={null}
Draft Invoice
      ↓
Merchant Review
      ↓
Amount Updated
      ↓
Invoice Approved
```

### Step 5: Collection

After the invoice is approved, Transact Bridge attempts to collect **₹2,500** from the customer's saved payment mandate.

If the payment succeeds, subscription continues for next billing cycle. And in case the payment fails, Transact Bridge applies the configured retry, due, overdue, or unpaid-invoice policies.

## Billing Date Anchor

If a **Billing Date Anchor** is configured, the invoice can be generated according to the configured fixed billing date instead of the subscription billing date.

For example:

```text theme={null}
Subscription Anniversary:
5 August

Billing Date Anchor:
1 September
```

In this case, invoice generation follows the configured billing date anchor.

<Note>
  **In a postpaid subscription, the customer uses the service first. Transact Bridge generates a draft invoice at the end of the billing cycle, sends the draft invoice webhook to the merchant, allows the merchant to review and approve the invoice, and then attempts collection using the customer's saved payment method or mandate.**
</Note>
