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

# Understand the Payment Lifecycle on watt.ma

> Track every status of a payment attempt on watt.ma: creation, pending, success, failure, refund, and synchronization with the provider.

Every payment attempt on watt.ma follows a clear and traceable lifecycle. Whether settlement goes through CMI, Stripe, or bank transfer, the status is centralized in a single interface. This transparency lets administrators track collections in real time and react quickly in case of anomalies.

## Lifecycle Statuses

```text theme={null}
Created → Pending → Successful
```

Possible alternatives from **Pending**:

```text theme={null}
Pending → Failed
Pending → Canceled
Successful → Refunded
Successful → Partially Refunded
```

## Status Descriptions

| Status                 | Description                                                                                                                     | Action Required                                                                                                |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| **Created**            | The payment request is generated by the watt.ma billing engine following a session or an invoice.                               | None. The payment is waiting to be transmitted to the provider.                                                |
| **Pending**            | The payment provider has received the request. The user is authenticating their payment method or the debit is being processed. | Wait for the provider's response. If the delay exceeds 15 minutes, check the history.                          |
| **Successful**         | The debit is confirmed by the provider. The amount is credited to the user's or site's billing account.                         | The receipt or invoice is marked as paid.                                                                      |
| **Failed**             | The provider refused the debit (card declined, insufficient balance, network error). The invoice remains unpaid.                | Retry the payment or update the payment method. See the [Payment Failures](/en/sessions/echecs-paiement) page. |
| **Canceled**           | The user or an administrator interrupted the attempt before the provider confirmed it.                                          | No debit occurred. Retry if necessary.                                                                         |
| **Refunded**           | The full amount has been returned to the customer. The original payment is kept in the history with a distinct status.          | Verify that the refund appears on the provider statement.                                                      |
| **Partially Refunded** | Only part of the initial amount has been returned. The remaining balance is kept as credit.                                     | Record the reason for the partial refund in the payment notes.                                                 |

## Fields Kept for Each Payment

watt.ma preserves the full data of every attempt to ensure accounting traceability:

* **watt.ma payment ID**: unique internal reference (e.g., `WAT-000183-PAY`)
* **Provider transaction ID**: identifier returned by CMI or Stripe
* **Amount** and **currency**: expressed in MAD (or in Stripe currency when multi-currency integration is active)
* **Linked invoice**: reference of the associated invoice or receipt
* **Billing account**: client or syndicate targeted by the debit
* **Payment method**: card, CMI QR, bank transfer
* **Timestamp**: date and time of creation, update, and confirmation
* **Status**: one of the statuses listed above

<Note>
  A payment with a **Successful** status does not yet mean the money is in your bank account. The settlement delay depends on the provider: J+2 to J+5 for CMI, J+7 for Stripe. Visit the [Reconciliation](/en/sessions/rapprochement) page to link the bank collection to the payment.
</Note>

## Difference Between Authorization, Capture, and Confirmation

| Term              | Definition                                                                                        | Usage Context                                                  |
| ----------------- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| **Authorization** | The provider checks that the payment method is valid and reserves the amount without debiting it. | Long sessions or pre-payment for public charging.              |
| **Capture**       | The reserved amount is actually debited from the customer's account.                              | At the end of the session, the finalized amount is captured.   |
| **Confirmation**  | The provider notifies watt.ma that the debit is effective.                                        | Recording of the **Successful** status and receipt generation. |

<Tip>
  For CMI QR payments, authorization and capture happen in a single step during the scan. The customer pays the exact amount calculated by the billing engine before the session starts.
</Tip>

## Concrete Example: CMI QR Payment

watt.ma generates the payment for session `WAT-000183` on charger `CP-001` at the Green Energy Park site. The calculated amount is 87.50 MAD (VAT 20 % included).

<Steps>
  <Step title="QR code generation">
    The billing engine creates a payment with **Created** status and ID `WAT-000183-PAY`. A unique QR code is displayed on the charger screen.
  </Step>

  <Step title="Customer scan">
    The driver scans the QR with their banking app. The status changes to **Pending**.
  </Step>

  <Step title="CMI confirmation">
    CMI confirms the debit. The status changes to **Successful**. watt.ma generates the PDF receipt and sends a WhatsApp copy if the option is enabled.
  </Step>

  <Step title="Bank reconciliation">
    Two days later, the CMI transfer arrives in the bank account. The administrator reconciles payment `WAT-000183-PAY` with transfer BANK-2026-00217 in the [Reconciliation](/en/sessions/rapprochement) interface.
  </Step>
</Steps>

## Special Cases

### Retry and Idempotency

If an attempt fails due to a network error, watt.ma lets you retry it. The original payment ID is preserved and a new attempt is created with a distinct ID to avoid any double debit. The engine refuses any duplicate capture for the same payment.

### Apparent Double Debit

A customer may think they were debited twice if the status displayed in watt.ma is not yet updated. This happens when the provider's feedback is delayed. The remedy is to verify the provider transaction ID in the payment detail before authorizing a refund.

### Provider Delay

Some temporary failures are due to the banking network and not the customer's card. watt.ma offers a 15-minute grace period before switching the status to definitively **Failed**. During this window, the provider may still confirm a success.

## See Also

<CardGroup cols={2}>
  <Card title="CMI Payments" icon="qrcode" href="/en/sessions/paiements-qr-cmi">
    Activate QR code payment for Moroccan customers.
  </Card>

  <Card title="Stripe" icon="stripe" href="/en/sessions/stripe">
    Pilot program for international cards and recurring debits.
  </Card>

  <Card title="Payment Failures" icon="triangle-exclamation" href="/en/sessions/echecs-paiement">
    Manage declines, expired cards, and automatic reminders.
  </Card>

  <Card title="Bank Reconciliation" icon="building-columns" href="/en/sessions/rapprochement">
    Record transfers and reconcile payments with your bank account.
  </Card>
</CardGroup>
