Skip to main content

M-Pesa Deposits

Get deposits from a user using M-Pesa

A deposit is made by transferring funds from a users M-Pesa account to your merchants wallet using the api/Transaction/MPesaDeposit endpoint.

Steps

  • Add an M-Pesa deposit Transaction
  • Wait for callback
  • Check status

After you have called the "MpesaDeposit" endpoint a payment request is sent to the M-Pesa network and the user will confirm the transaction on their phone. A pending transaction is also created and Xprizo will continue monitoring the M-Pesa netork until a confirmation or failure is received.

  • If a confirmation is received the pending transaction will be converted into a completed transaction.
  • If the transaction cancelled then a notification will be created on the Merchants account with details about the cancellation.

The Merchant will get updates on the status of the transaction via callbacks. To receive callback, you will need to set this up on your account. (the profile that is used to create this transaction). This can be done by going to setting/preferences in Xprizo and setting the "Approval Webhook" to point to a url of your choice. You can also set this using api/Preference/SetApprovalWebhook

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 can just intermittently check status of the transaction but this is not really recommended as you would need to continually poll the server to check the status. Your should however, check the status, after you get a callback to confirm that the transaction did complete successfully.

Use this endpoint to check the status api/Transaction/StatusByReference

info
  • Pending transaction are checked
    • Every 15 seconds in the first minute
    • Every 30 seconds in the first 5 minutes
    • Every 1 minute in the the first 10 minutes
    • Every 10 minutes after that

Testing

Testing can be done on our test server. Testing will not send transactions M-Pesa

Assign the following words into the description field to get different results.

  • 'Pass' - the transaction will be created as if it completed correctly
  • 'Cancel' - the transaction will be created and then rejected and removed.

Flow

Flow