Tanzania Mobile Money

Learn about Mobile Money support in Tanzania.

📘

Getting Started

We recommend checking out the introduction to understand the basics of direct charge first. This guide assumes you’ve read that.


If you're collecting money in TZS, your customers can pay with Tanzania mobile money services.

The Process

This involves the following steps:

  1. You call our API to create a charge and pass in the customer's mobile number.
  2. Your customer completes the payment by authorizing it with their mobile money provider.
Tanzania mobile money payment flow

Initiating the Payment

To create a mobile money charge for a customer in Tanzania, you'll need the customer’s valid phone_number along with the following required parameters:

  • amount
  • currency
  • email
  • tx_ref (Unique transaction reference)

You can also specify additional details, such as the customer's fullname, redirect_url, the mobile money network, and custom meta information. For more information on each parameter and its definition, refer to the endpoint documentation.

// Install with: npm i flutterwave-node-v3

const Flutterwave = require('flutterwave-node-v3');
const flw = new Flutterwave(process.env.FLW_PUBLIC_KEY, process.env.FLW_SECRET_KEY);
const payload = {
  tx_ref: this.generateTransactionReference(),
  amount: 150,
  currency: 'TZS',
  email: '[email protected]',
  phone_number: '0782835136'
};
flw.MobileMoney.tanzania(payload)
  .then(console.log)
  .catch(console.log);
// Install with: composer require flutterwavedev/flutterwave-v3

use Flutterwave\Util\Currency;

$flw = new \Flutterwave\Rave(getenv('FLW_SECRET_KEY'));


$data = [
 "tx_ref" => uniqid().time(),
 "amount" => 150,
 "currency" => Currency::TZS,
 "redirectUrl" => null,
 "additionalData" => [
     "network" => "AIRTEL",
 ]
];

$momopayment = \Flutterwave\Flutterwave::create("momo");
$customerObj = $momopayment->customer->create([
   "full_name" => "John Doe",
   "email" => "[email protected]",
   "phone" => "+2550782835136"
]);
$data['customer'] = $customerObj;
$payload  = $momopayment->payload->create($data);
$result = $momopayment->initiate($payload);
curl --location 'https://api.flutterwave.com/v3/charges?type=mobile_money_tanzania' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{API_SECRET_KEY}}' \
--data-raw '{
  "tx_ref": "{{UNIQUE_TRANSACTION_REFERENCE}}",
  "amount": "150",
  "currency": "TZS",
  "email": "[email protected]",
  "phone_number": "0782835136"
}'

Handling the Response

You'll get a response that looks like this:

{
   "status": "success",
   "message": "Charge initiated",
   "data": {
       "id": 4376085,
       "tx_ref": "MC-158523s09v5050e8",
       "flw_ref": "flwm3s4m0c1686152189776",
       "device_fingerprint": "62wd23423rq324323qew1",
       "amount": 150,
       "charged_amount": 150,
       "app_fee": 21,
       "merchant_fee": 0,
       "processor_response": "Transaction in progress",
       "auth_model": "MOBILEMONEY",
       "currency": "TZS",
       "ip": "154.123.220.1",
       "narration": "Flutterwave Developers",
       "status": "pending",
       "payment_type": "mobilemoneytz",
       "fraud_status": "ok",
       "charge_type": "normal",
       "created_at": "2023-06-07T15:36:29.000Z",
       "account_id": 122055,
       "customer": {
           "id": 2095069,
           "phone_number": "0782835136",
           "name": "Anonymous Customer",
           "email": "[email protected]",
           "created_at": "2023-06-07T15:36:29.000Z"
       }
   }
}

You'll notice that the data.status is "pending", meaning the transaction is yet to be completed. The data.auth_model is "MOBILEMONEY", which means the customer will authorize this with their mobile money provider. Typically, they will get a push notification from the app and complete the payment by entering their PIN

Completing the Payment

To complete the payment, the customer needs to authorize it with their mobile money provider (for instance, via a push notification from the app).

🧪

Testing Tip

In Test Mode, Tanzania mobile money payments are automatically authorized after a few seconds.

When the payment is completed, we'll send you a webhook notification. Here's what the payload looks like:

{
   "event": "charge.completed",
   "data": {
       "id": 4376085,
       "tx_ref": "MC-158523s09v5050e8",
       "flw_ref": "flwm3s4m0c1686152189776",
       "device_fingerprint": "62wd23423rq324323qew1",
       "amount": 150,
       "currency": "TZS",
       "charged_amount": 150,
       "app_fee": 21,
       "merchant_fee": 0,
       "processor_response": "request successful",
       "auth_model": "MOBILEMONEY",
       "ip": "154.123.220.1",
       "narration": "Flutterwave Developers",
       "status": "successful",
       "payment_type": "mobilemoneytz",
       "created_at": "2023-06-07T15:36:29.000Z",
       "account_id": 122055,
       "customer": {
           "id": 2095069,
           "name": "Anonymous Customer",
           "phone_number": "0782835136",
           "email": "[email protected]",
           "created_at": "2023-06-07T15:36:29.000Z"
       }
   }
}

In your webhook handler, you can then verify the payment and credit your customers with whatever they paid for. See our guide to transaction verification for details.