# Billing & Credit Line

Canonical: https://docs.bluehola.com/docs/guides/billing
OpenAPI: https://docs.bluehola.com/openapi.yaml

Airtime for each customer account is managed with a credit account plus an append-only ledger: an amount is reserved before sending, settled once Meta accepts, and reversed automatically if delivery fails.

## The credit account

Each account has one credit balance, opened and adjusted by BlueMedia. To check or adjust your account's credit line, contact BlueMedia support.

## Account credit versus customer budgets

An account has exactly one overall balance; BlueMedia can set an independent **budget cap** for each customer entity on top of it, shared by every Business Portfolio under that customer, but that cap is not a second wallet. Adjusting a customer budget does not change the account's overall balance. To change your budget, contact BlueMedia support.

:::warning

When a customer's budget is exhausted, sending fails with `402 CUSTOMER_BUDGET_EXCEEDED`; when the account's overall balance is short, it returns `INSUFFICIENT_FUNDS`. They mean different things, so use the error code to tell BlueMedia whether the customer budget or the account credit needs adjusting. Historical messages can still show `BM_BUDGET_EXCEEDED`, which means the same as `CUSTOMER_BUDGET_EXCEEDED`. Broadcasts are costed in full **at creation time** and rejected up front, so they never stop halfway through.

:::

## Reservation → settlement → reversal

| When                    | What happens                                                                                                                           |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| Message submitted (accepted)    | A `reserved` amount is locked and a reservation record created. The amount is the message's price from your rate card at the highest rate that can apply (a flat fallback estimate only when it cannot be priced), so settlement only ever releases the difference. An insufficient account balance gives `402 INSUFFICIENT_FUNDS` outright, and an exhausted customer budget gives `402 CUSTOMER_BUDGET_EXCEEDED`. |
| Meta accepts (returns a wamid) | Settlement: the reservation becomes an actual charge and a ledger entry is written.                                                                                           |
| `failed` status callback         | The charge is reversed automatically (idempotency key `reverse:<messageId>`, so repeated callbacks do not reverse twice).                                                         |

The ledger is append-only (ledger\_entries — inserts, never updates), and a given idempotency key is posted at most once, so retries and duplicate callbacks cannot produce a double charge.

```mermaid
sequenceDiagram
    autonumber
    participant C as Caller
    participant P as BlueMedia
    participant M as Meta
    C->>P: POST /v1/messages
    P->>P: Lock the reserved amount, create a reservation record
    Note over P: Insufficient balance → 402 INSUFFICIENT_FUNDS<br/>Customer budget exhausted → 402 CUSTOMER_BUDGET_EXCEEDED
    P-->>C: 202 accepted
    P->>M: Submit the message
    M-->>P: Accepted, returns a wamid
    P->>P: Settle: reservation becomes a charge, ledger entry written
    M-->>P: failed status callback
    P->>P: Automatic reversal (idempotency key derived from messageId, no double reversal)
```


## Service-message pricing from 2026-10-01

Meta began charging per message for non-template service replies sent on or after **2026-10-01**, including replies inside an open 24-hour customer service window. Utility templates sent inside that window also became chargeable on that date. The open window still determines whether a non-template reply is allowed; it no longer makes the reply free. Messages sent before the change keep the pricing rule for their send date.

Service-message rates vary by recipient market and match Meta's utility and authentication rates, without volume tiers for service messages. Check your applicable rate card for the amount. A later `failed` status still reverses the charge as described above; Meta's pricing information in a status callback can also identify a message as non-billable.

## Meta credit line sharing

Before a customer can use a credit line to send template messages, BlueMedia must authorize the line and attach it to a WABA. Meta first shares the line with the customer's Business Portfolio and then attaches it to a specific WABA — which is why other WABAs under the same Business Portfolio share that authorization. Once authorized, BlueMedia settles the WhatsApp spend with Meta. Sending from a Business Portfolio whose credit line is not ready fails with `CREDIT_LINE_NOT_READY`; contact BlueMedia support to have it authorized.
