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

# Quickstart: Customer Balance

> Accept a payment against a customer balance using the Billing API

This guide walks through the most common billing model: creating a customer with a balance and handling the payment webhook when that balance is settled. This model is suited for merchants who track a single running balance per customer without needing separate accounts or individual bills.

## Prerequisites

* A test API key. See [Authentication](/api-reference/getting-started/authentication).
* A registered webhook endpoint. See [Webhook Setup](/api-reference/webhooks/setup) to register your URL and obtain your signing key.

***

## Step 1: Create a customer

Create a customer with a `balance` representing what they currently owe, in minor units.

```bash theme={"system"}
curl -X POST https://api.momentpay.net/billing/customers \
  -H "Authorization: Bearer sk_test_YOUR_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_reference": "UCR1234567890",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "currency": "ZAR",
    "balance": 2000
  }'
```

<Note>
  `balance` is specified in minor units. See [Monetary Amounts](/api-reference/getting-started/monetary_amounts) for details.
</Note>

The response returns an `id`. Store this to reference the customer in future calls.

```json theme={"system"}
{
  "id": "bcus_H4jp6KnU5cPw263v1jyz4",
  "external_reference": "UCR1234567890",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "balance": 2000
}
```

***

## Step 2: Present the balance for payment

With the customer created, present their balance for payment using [Electronic Bill Presentment](/documentation/billing/ebp) or a [Payment Request](/documentation/collect/payment-links/payment-requests).

***

## Step 3: Handle the payment webhook

When payment is received against the customer balance, Moment sends an `obligation.amount_applied` event.

```json theme={"system"}
{
  "id": "evt_2341234567890abcdef",
  "type": "obligation.amount_applied",
  "data": {
    "id": "ob_N2a38DJQWPL8K4X42354234",
    "amount": 2000,
    "currency": "ZAR",
    "payment_id": "pay_1313235234843nmafdsa",
    "customer_id": "bcus_H4jp6KnU5cPw263v1jyz4"
  }
}
```

Use `data.customer_id` to identify which customer paid and `data.amount` to reconcile against their balance.

Before processing, verify the event signature. See [Webhook Verification](/api-reference/webhooks/verification).

Respond with a `2xx` status code to acknowledge receipt.

***

## Next steps

<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-6">
  <Card title="Quickstart: Account Balance" icon="folder" href="/api-reference/billing/quickstart-account-balance">
    Track balances across multiple sub-accounts within a customer.
  </Card>

  <Card title="Quickstart: Bill Amount Due" icon="file-invoice" href="/api-reference/billing/quickstart-bill-amount-due">
    Raise a specific bill with an amount due and a due date.
  </Card>

  <Card title="Electronic Bill Presentment" icon="browser" href="/documentation/billing/ebp">
    Present balances and bills to customers via a hosted payment page.
  </Card>

  <Card title="Uploading Bills" icon="upload" href="/documentation/billing/uploading-bills">
    Ingest customer balances and bills in bulk via SFTP or file integration.
  </Card>

  <Card title="Common Operations" icon="code" href="/api-reference/billing/examples">
    Examples for updating customer balances, account balances, and bills.
  </Card>
</div>
