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

# Daraja callbacks

> Understand how Moflay handles Safaricom Daraja callbacks for you after an M-Pesa Express payment request.

Moflay handles Safaricom Daraja callbacks for you. You do not need to expose a Daraja callback endpoint, configure callback routing, or process raw Safaricom callback payloads in your backend.

<CardGroup cols={2}>
  <Card title="Payment statuses & outcomes" icon="list-checks" href="/payments/transaction-statuses">
    Moflay transaction statuses, Daraja `ResultCode` mappings, webhooks, and polling `GET /v1/payments/{id}`.
  </Card>
</CardGroup>

## How callback handling works

When you create an M-Pesa Express payment through Moflay:

1. Moflay sends the STK Push request to Safaricom.
2. Safaricom sends the payment result back to Moflay.
3. Moflay matches the result to the payment request.
4. Moflay updates the payment and transaction status.
5. Your application reads the result from Moflay.

The callback relationship is between Safaricom and Moflay. Your integration stays focused on creating payments and responding to [Moflay transaction statuses](/payments/transaction-statuses).

## What your application does

For most integrations, your application should:

* Create the payment with Moflay.
* Store the returned Moflay payment or transaction identifier.
* Handle the returned transaction status in your application.
* Check the Moflay dashboard or transaction APIs when you need to inspect a payment later.

## What you do not need to build

When you use Moflay, you do not need to:

* Expose your own Safaricom callback endpoint
* Configure Daraja callback routing for Moflay payments
* Parse raw Daraja callback payloads
* Map Safaricom result codes to transaction statuses
* Store M-Pesa receipt data from callbacks yourself

## Common questions

<AccordionGroup>
  <Accordion title="Do I need to set up Safaricom callback handling?">
    No. Moflay handles Safaricom callback processing for Moflay payments.
  </Accordion>

  <Accordion title="How do I know when a payment is complete?">
    Use the payment or transaction status returned by Moflay. You can also inspect transactions in the Moflay dashboard or through the transaction APIs.
  </Accordion>

  <Accordion title="What happens when the customer cancels or the request expires?">
    Moflay returns a transaction status your application can handle. See [Payment statuses & outcomes](/payments/transaction-statuses) for each status value and recommended action.
  </Accordion>
</AccordionGroup>

## Related pages

* [Set up production credentials](/daraja/setup-production-credentials)
* [Set up sandbox credentials](/daraja/setup-sandbox-credentials)
* [Payment statuses & outcomes](/payments/transaction-statuses)
