Skip to content

Withdrawal (Payout) ​

Send money to a customer's Mobile Money wallet. Funds are debited from your Moko wallet and credited asynchronously to the customer's operator wallet.

Endpoint ​

POST https://api.gofreshpay.com/api/v1/gateway

Content-Type: application/json. No auth header — credentials go in the body (see Overview).

Body parameters ​

FieldTypeRequiredDescription
merchant_idstring✅Your merchant identifier
merchant_secretestring✅Your API secret (note the spelling)
actionstring✅credit — for withdrawal
methodstring✅mpesa, orange, airtel, afrimoney
amountstring✅Amount to send
currencystring✅CDF or USD
customer_numberstring✅Recipient phone number in 243XXXXXXXXX format
referencestring✅Your unique reference for the payout
firstnamestring✅Recipient's first name
lastnamestring✅Recipient's last name
emailstring✅Recipient's email
callback_urlstringWebhook URL for async notifications

Examples ​

bash
curl -X POST https://api.gofreshpay.com/api/v1/gateway \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "your_merchant_id",
    "merchant_secrete": "your_merchant_secret",
    "action": "credit",
    "method": "mpesa",
    "amount": "5000",
    "currency": "CDF",
    "customer_number": "243970000000",
    "reference": "payout_001",
    "firstname": "John",
    "lastname": "Doe",
    "email": "john@example.com",
    "callback_url": "https://yoursite.com/webhook"
  }'
javascript
const axios = require('axios');

const { data } = await axios.post(
  'https://api.gofreshpay.com/api/v1/gateway',
  {
    merchant_id: 'your_merchant_id',
    merchant_secrete: 'your_merchant_secret',
    action: 'credit',
    method: 'mpesa',
    amount: '5000',
    currency: 'CDF',
    customer_number: '243970000000',
    reference: 'payout_001',
    firstname: 'John',
    lastname: 'Doe',
    email: 'john@example.com',
    callback_url: 'https://yoursite.com/webhook',
  }
);

console.log(data);
python
import requests

response = requests.post(
    'https://api.gofreshpay.com/api/v1/gateway',
    json={
        'merchant_id': 'your_merchant_id',
        'merchant_secrete': 'your_merchant_secret',
        'action': 'credit',
        'method': 'mpesa',
        'amount': '5000',
        'currency': 'CDF',
        'customer_number': '243970000000',
        'reference': 'payout_001',
        'firstname': 'John',
        'lastname': 'Doe',
        'email': 'john@example.com',
        'callback_url': 'https://yoursite.com/webhook',
    }
)

print(response.json())
php
<?php
$ch = curl_init('https://api.gofreshpay.com/api/v1/gateway');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'merchant_id'      => 'your_merchant_id',
    'merchant_secrete' => 'your_merchant_secret',
    'action'           => 'credit',
    'method'           => 'mpesa',
    'amount'           => '5000',
    'currency'         => 'CDF',
    'customer_number'  => '243970000000',
    'reference'        => 'payout_001',
    'firstname'        => 'John',
    'lastname'         => 'Doe',
    'email'            => 'john@example.com',
    'callback_url'     => 'https://yoursite.com/webhook',
]));

$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response));

Response (200 OK) ​

json
{
  "Reference": "payout_001",
  "Customer_Number": "243970000000",
  "Amount": 5000.0,
  "Currency": "CDF",
  "Created_At": "2026-03-06 13:05:35.018745",
  "Updated_At": "2026-03-06 13:05:35.018764",
  "Transaction_id": "PDz9OCe03Lw3061V63n26qVC"
}

Asynchronous payout

The initial response confirms that the payout was initiated. Funds are delivered to the recipient's wallet asynchronously (typically within a few seconds to a few minutes). The actual result arrives via the webhook on your callback_url with Trans_Status = Successful | Failed | Pending.

Response fields ​

FieldDescription
ReferenceYour original reference
Customer_NumberRecipient phone number
AmountAmount
CurrencyCDF or USD
Created_AtCreation timestamp on Moko's side
Updated_AtLast update timestamp
Transaction_idUnique Moko identifier (store it for verify)

Payout precautions ​

  • Check your Moko wallet balance before initiating a large payout — if it is insufficient, the request will be rejected (Trans_Status: Failed with an insufficient balance message in the webhook)
  • Double-check the customer_number — a wrong number can send the funds to someone else
  • Idempotency: don't retry the same reference twice without first checking the status of the initial attempt via Verify

Next steps ​

  • Webhooks — receive the final result
  • Verify — check status by reference

Moko Afrika · The payment infrastructure of the DRC