# How do I verify a payment?
Source: https://docs.lomi.africa/build/reliability/verify-payments

Confirm payment status server-side with the API and webhooks, never trust the browser redirect alone.

***

title: 'How do I verify a payment?'
description: 'Confirm payment status server-side with the API and webhooks, never trust the browser redirect alone.'
docType: how-to
---------------

import { Callout } from '@/components/docs/docs-callout';
import { DocsAgentIndex } from '@/components/docs/docs-agent-index';

<DocsAgentIndex />

A customer may close the browser, lose network connectivity, or return to your `success_url` before lomi. has finished processing, especially with **mobile money** and **3D Secure** cards. Treat the redirect as a UX hint, not proof of payment.

<Callout type="warn" title="Never fulfill on redirect alone">
  Do not ship goods, unlock content, or mark an invoice paid based only on `success_url` query parameters or client-side JavaScript. Always verify on your server.
</Callout>

## Recommended verification order

1. **Webhook**: lomi. POSTs to your HTTPS endpoint when the transaction reaches a final state (preferred for async rails).
2. **API read**: `GET /transactions/{id}` or list with filters when you have the transaction ID from the checkout session or charge response.
3. **Dashboard**: manual ops and support; not for production fulfillment automation.

## Hosted checkout

After the customer pays:

1. Store your internal `order_id` in checkout session `metadata` when you create the session.
2. On `success_url`, show a “processing” state, not “paid”-until your backend confirms.
3. When you receive `PAYMENT_SUCCEEDED`, match `metadata.order_id` and fulfill only after `GET /transactions/{id}` shows `transaction_status` of `completed`.

See [Payment and payout lifecycle](/build/reliability/payment-lifecycle) for status meanings and [Handling webhooks](/build/reliability/handling-webhooks) for signature verification.

## Direct charges (Wave, MTN, card)

| Rail                  | When to verify                                                          |
| --------------------- | ----------------------------------------------------------------------- |
| **Wave (live)**       | After customer approves in the Wave app, webhook or poll transaction    |
| **MTN (live)**        | Starts `PENDING`; verify before fulfill                                 |
| **MTN / Wave (test)** | May complete immediately; still verify server-side in integration tests |
| **Card**              | After `client_secret` confirmation; watch for `requires_action`         |

## Idempotency on fulfill

Your fulfillment handler (webhook worker or API poller) must be **idempotent**: processing the same `transaction_id` or webhook event `id` twice must not double-ship. Store processed event IDs or use database constraints on `order_id` + `status = fulfilled`.

## Confirm before you fulfill

* `success_url` shows pending until server confirms
* Webhook endpoint verifies `X-Lomi-Signature` on the raw body
* Fulfillment runs only when `transaction_status` is `completed`
* Refunds and chargebacks have a reversal path

<DocsNextSteps>
  <DocsNextStep href="/start/integration-journey" hint="Sandbox to live">
    Integration journey
  </DocsNextStep>

  <DocsNextStep href="/api/transactions/TransactionsController_findAll" hint="Poll when webhooks lag">
    List transactions
  </DocsNextStep>

  <DocsNextStep href="/start/sandbox-payments" hint="Test cards and wallets">
    Sandbox payments
  </DocsNextStep>
</DocsNextSteps>
