# Deposit Using MPESA

<div class="w-full pt-2 md:pt-0 dark:border-white/20 md:border-transparent md:dark:border-transparent md:w-[calc(100%-.5rem)]" id="bkmrk-4.1-flow-this-is-an-"><div class="w-full pt-2 md:pt-0 dark:border-white/20 md:border-transparent md:dark:border-transparent md:w-[calc(100%-.5rem)]"><form class="stretch mx-2 flex flex-row gap-3 last:mb-2 md:mx-4 md:last:mb-6 lg:mx-auto lg:max-w-2xl xl:max-w-3xl">To make deposits from a user via M-Pesa, initiate a deposit by transferring funds from the user's M-Pesa account to your merchant's wallet using the **[<span style="color: #3598db;">Transaction/MPesaDeposit</span>](https://books.xprizo.com/link/22#bkmrk-create-deposit-reque)** endpoint.

#### **Flow​**

![User Journey Mapping (20).jpg](https://books.xprizo.com/uploads/images/gallery/2024-02/scaled-1680-/user-journey-mapping-20.jpg)

#### **Steps**[​](https://xprizo-doc.azurewebsites.net/docs/merchants/card-deposits#steps "Direct link to heading")

- Add an M-Pesa deposit Transaction
- Wait for callback
- Check Status

Once you've called the "MpesaDeposit" endpoint, a payment request is sent to the M-Pesa network and the user will then confirm the transaction on their phone. A pending transaction is also generated, and Xprizo will continuously monitor the M-Pesa network until a confirmation or failure is received.

- If a confirmation is received, the pending transaction will transition into a completed transaction.
- If the transaction is cancelled, a notification containing details about the cancellation will be generated and sent to the merchant's account.

Merchants will receive updates on the transaction status via callbacks. To enable callbacks, you'll need to configure this on your account (the profile used to create the transaction). You can accomplish this by navigating to the settings/preferences in Xprizo and configuring the "Approval Webhook" to point to a URL of your choice. Alternatively, you can achieve the same using the **[<span style="color: #3598db;">Preference/SetApprovalWebhook</span>](https://books.xprizo.com/link/31#bkmrk-update-approval-webh)** endpoint.

A callback will be sent when

- the pending transaction is created.
- the pending transaction is approved
- the pending transaction is cancelled

It is not strictly necessary to use callbacks, you have the option to periodically check the status of the transaction. However, it's not recommended as it would require to poll the server continuously to check the status. However, it's advisable to verify the status after receiving a callback to ensure that the transaction was completed successfully.

<div class="w-full text-token-text-primary" data-testid="conversation-turn-148"><div class="px-4 py-2 justify-center text-base md:gap-6 m-auto"><div class="flex flex-1 text-base mx-auto gap-3 md:px-5 lg:px-1 xl:px-5 md:max-w-3xl lg:max-w-[40rem] xl:max-w-[48rem] group"><div class="relative flex w-full flex-col lg:w-[calc(100%-115px)]"><div class="flex-col gap-1 md:gap-3"><div class="flex flex-grow flex-col max-w-full"><div class="min-h-[20px] text-message flex flex-col items-start gap-3 whitespace-pre-wrap break-words [.text-message+&]:mt-5 overflow-x-auto" data-message-author-role="user" data-message-id="aaa2e400-a4cc-4708-b4a4-909cb35e5c99"><div class="">Use this endpoint to check the status **<span style="color: #3598db;">[Transaction/Status](https://books.xprizo.com/link/22#bkmrk-transaction-status-c)</span>**[<span style="color: #3598db;">.</span>](https://books.xprizo.com/link/22#bkmrk-transaction-status-c)</div><div class="">  
</div></div></div></div></div></div></div></div><p class="callout info">**\*\* You should, however, check the status, after you get a callback to confirm that the transaction was completed successfully. You can use <span style="color: #3598db;">[Transaction/Status](https://books.xprizo.com/link/22#bkmrk-transaction-status-c)</span> endpoint to check the status.**</p>

</form></div></div>