# Refunds
Source: https://docs.lomi.africa/build/money/refunds

Refund completed transactions (`POST /refunds`).

***

title: Refunds
description: Refund completed transactions (`POST /refunds`).
-------------------------------------------------------------

import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
import { Callout } from '@/components/docs/docs-callout';

Use **`POST /refunds`** to refund a **completed** transaction. Supported providers are **card**, **Wave**, and **MTN** (same flows as the dashboard). Your **balance is updated immediately**; customer credit timing depends on the payment type.

<TaskSurfaces task="refunds-and-disputes" />

<Callout type="info">
  **MTN (live):** the original payment must have a provider reference (`provider_checkout_id` from RequestToPay). Refunds use the MTN Disbursement refund API and are asynchronous on MTN's side; lomi. polls until completion. **Test mode** refunds are ledger-only (no MTN API call).
</Callout>

List and retrieve refunds with **`GET /refunds`** and **`GET /refunds/{id}`**.

<Callout type="info">
  Card refunds are recorded immediately on your account. The customer's bank or card issuer typically posts the credit within several business days.
</Callout>

<Callout type="info">
  lomi. Network Operators can add `Lomi-Account: acct_...` to refund a connected Member Account transaction when the membership has `refund.create`.
</Callout>

## Create a refund

<Tabs items={["TypeScript", "Python", "cURL"]}>
  <Tab value="TypeScript">
    ```typescript
    import { LomiSDK } from '@lomi./sdk';

    const lomi = new LomiSDK({
      apiKey: process.env.LOMI_SECRET_KEY!,
      environment: 'live',
    });

    const refund = await lomi.refunds.create({
      transaction_id: '123e4567-e89b-12d3-a456-426614174000',
      amount: 5000,
      reason: 'duplicate_charge',
      refund_type: 'partial', // optional: 'full' | 'partial'
    });
    ```
  </Tab>

  <Tab value="Python">
    ```python
    import requests, os

    r = requests.post(
        "https://api.lomi.africa/refunds",
        headers={"X-API-KEY": os.environ["LOMI_SECRET_KEY"], "Content-Type": "application/json"},
        json={
            "transaction_id": "123e4567-e89b-12d3-a456-426614174000",
            "amount": 5000,
            "reason": "duplicate_charge",
        },
    )
    print(r.status_code, r.json())
    ```
  </Tab>

  <Tab value="cURL">
    ```bash
    curl -X POST "https://api.lomi.africa/refunds" \
      -H "X-API-KEY: $LOMI_SECRET_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "transaction_id": "123e4567-e89b-12d3-a456-426614174000",
        "amount": 5000,
        "reason": "duplicate_charge"
      }'
    ```
  </Tab>
</Tabs>

Network refund:

```bash
curl -X POST "https://api.lomi.africa/refunds" \
  -H "X-API-KEY: $LOMI_OPERATOR_API_KEY" \
  -H "Lomi-Account: acct_1234567890" \
  -H "Content-Type: application/json" \
  -d '{
    "transaction_id": "123e4567-e89b-12d3-a456-426614174000",
    "amount": 5000,
    "reason": "duplicate_charge"
  }'
```

## Payload reference

| Field            | Type                    | Required                                                   |
| ---------------- | ----------------------- | ---------------------------------------------------------- |
| `transaction_id` | `string` (UUID)         | **Yes**                                                    |
| `amount`         | `number`                | **Yes**                                                    |
| `reason`         | `string`                | No                                                         |
| `refund_type`    | `'full'` \| `'partial'` | No, inferred from `amount` vs transaction gross if omitted |

## List refunds

`GET /refunds?status=completed&limit=50&offset=0`

## Get a refund

`GET /refunds/{refund_id}`
