Skip to main content

Send To Mobile

Introduction

The "Send To Mobile" feature enables users to send money to a mobile number by making an HTTP POST request to our API. This documentation provides details on how to send money to a mobile number and includes code examples in various programming languages.

Sending Money To Mobile

To send money to a mobile number, users need to make an HTTP POST request to the specified endpoint with the required parameters.

Endpoint

https://api.mypayd.app/api/v2/withdrawal

Authorization

Users need to include basic authentication credentials in the request headers.

AUTHORIZATION: Basic Auth

Username <username>
Password <password>

The Token object

The request body should include the following parameters:

json
{
"account_id": "account123",
"phone_number": "+254799000088",
"amount": 100,
"narration": "Withdrawal request",
"callback_url": "https://example.com/callback",
"channel": "63902"
}

Network codes

There are different network codes for different mobile providers.

Safaricom - 63902
Airtel - 63903

Code Examples

Below are code examples in different programming languages demonstrating how to send money to a mobile number using HTTP POST requests.

curl --location 'https://api.mypayd.app/api/v2/withdrawal' \
--data '{
"account_id": "sender123",
"channel": "63902"
"phone_number": "0712345678",
"amount": 500.0,
"narration": "Payment for services",
"callback_url": "https://example.com/mpesa-callback"
}
'

Example of a successful response

{
"responseCode": "200",
"message": "Transaction successful",
"merchantRequestID": "merchant123",
"transactionReference": "trans123",
"paymentGateway": "paystack",
"checkoutRequestID": "checkout123",
"customerMessage": "Thank you for your payment"
}