Send Money

Send money from your IntaSend account to mobile money account e.g M-PESA.

post
Step 1 - Initiate send money

https://sandbox.intasend.com/api/v1/send-money/initiate/
This endpoint allows you to initiate send money requests. This method only initiates the send money process. You'll need to approve the transaction using your approval private key.
Request
Response
Request
Headers
Authentication
required
string
Bearer <TOKEN>
Body Parameters
device_id
required
number
Create device under API section on the dashboard, add a public key, and obtain its id.
provider
required
string
Options are: MPESA-B2C, INTASEND
callback_url
optional
string
URL to send payment notification
transactions
required
array
List of transactions
currency
required
string
KES
Response
200: OK
Payment successfully received
{
"tracking_id": "c1acf08c-5cc1-4b3e-b4a8-e43bc068aa56",
"status": "Preview and approve",
"nonce": "1aiw02",
"device_id": 1,
"transactions": [
{
"status": "Pending",
"request_reference_id": "f6a5a8dc-e190-4707-8ea2-102919709a72",
"name": null,
"account": 254723890353,
"amount": 10,
"narrative": null
},
{
"status": "Pending",
"request_reference_id": "cd763f35-44b3-4e89-a27a-252d507105f6",
"name": null,
"phone_number": 254708374149,
"amount": 500,
"narrative": null
}
],
"charge_estimate": 50.0,
"total_amount_estimate": 560.0,
"created_at": "2020-07-31T14:00:56.563163+03:00",
"updated_at": "2020-07-31T14:00:56.632188+03:00"
}

Transaction list items

Parameter

Type

Required

Description

name

string

Yes

Beneficiary name

account

integer

Yes

Beneficiary phone number. Must be in the format 2547xxxxxxxxx - note the country prefix 254 without a +

amount

integer

Yes

Amount to send

NB - Obtain tracking_id for the purpose of checking status.

Code examples

Python
PHP
Go
Ruby
Java
Python
import requests
url = "http://sandbox.intasend.com/api/v1/send-money/initiate/"
payload = {'provider': 'MPESA-B2C', 'currency': 'KES', 'callback_url': 'https://example.com', 'transactions': [{'name': 'test-name', 'account': 254723890353, 'amount': 10}], 'device_id': 1}
headers = {
'Authorization': 'Bearer LfqRDqvfvwv77BhxuDsdXN04NyUx97',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "http://sandbox.intasend.com/api/v1/send-money/initiate/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS =>"{\"transactions\": [{\"account\": \"254723890353\", \"amount\": \"5\"}, {\"account\": \"254723890323\", \"amount\": \"5000\"}], \"currency\": \"KES\", \"callback_url\": \"http://127.0.0.1:8000/false-api/\", \"device_id\": \"1\"}",
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer LfqRDqvfvwv77BhxuDsdXN04NyUx97",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://sandbox.intasend.com/api/v1/send-money/initiate/"
method := "POST"
payload := strings.NewReader("{\"transactions\": [{\"account\": \"254723890353\", \"amount\": \"5\"}, {\"account\": \"254723890323\", \"amount\": \"5000\"}], \"currency\": \"KES\", \"callback_url\": \"http://127.0.0.1:8000/false-api/\", \"device_id\": \"1\"}")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
}
req.Header.Add("Authorization", "Bearer LfqRDqvfvwv77BhxuDsdXN04NyUx97")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
Ruby
require "uri"
require "net/http"
url = URI("http://sandbox.intasend.com/api/v1/send-money/initiate/")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer LfqRDqvfvwv77BhxuDsdXN04NyUx97"
request["Content-Type"] = "application/json"
request.body = "{\"transactions\": [{\"account\": \"254723890353\", \"amount\": \"5\"}, {\"account\": \"254723890323\", \"amount\": \"5000\"}], \"currency\": \"KES\", \"callback_url\": \"http://127.0.0.1:8000/false-api/\", \"device_id\": \"1\"}"
response = http.request(request)
puts response.read_body
Java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"transactions\": [{\"phone_number\": \"254723890353\",\"amount\": \"5\"},{\"phone_number\": \"254723890323\",\"amount\": \"5000\"}],\"currency\": \"KES\",\"device_id\": \"1\",\"callback_url\": \"http://127.0.0.1:8000/false-api/\"}");
Request request = new Request.Builder()
.url("http://sandbox.intasend.com/api/v1/send-money/initiate/")
.method("POST", body)
.addHeader("Authorization", "Bearer LfqRDqvfvwv77BhxuDsdXN04NyUx97")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();

Sample response

Successful request
Failed request
Successful request
{
"tracking_id": "c1acf08c-5cc1-4b3e-b4a8-e43bc068aa56",
"status": "Preview and approve",
"nonce": "1aiw02",
"device_id": 1,
"transactions": [
{
"status": "Pending",
"request_reference_id": "f6a5a8dc-e190-4707-8ea2-102919709a72",
"name": null,
"account": 254723890353,
"amount": 10,
"narrative": null
},
{
"status": "Pending",
"request_reference_id": "cd763f35-44b3-4e89-a27a-252d507105f6",
"name": null,
"phone_number": 254708374149,
"amount": 500,
"narrative": null
}
],
"charge_estimate": 50.0,
"total_amount_estimate": 560.0,
"created_at": "2020-07-31T14:00:56.563163+03:00",
"updated_at": "2020-07-31T14:00:56.632188+03:00"
}
Failed request
# Returned with http status 400, 403, 401 depending on error type
# Reason for failure will be indicated under "details".
Sample response:
{'details': 'Device id not found'}

post
Step 2 - Approve send money

https://sandbox.intasend.com/api/v1/send-money/approve/
Every transaction must be approved using the approval secret key. Only after approval, the transaction will be processed. Learn more about how to sign and approve a transaction using a digital key please check Extra Authentication - https://developers.intasend.com/apis/extra-payment-authentication.
Request
Response
Request
Headers
Authorization
required
string
Bearer <TOKEN>
Body Parameters
payload
required
string
Send back the response returned in step 1 by signing and replacing the nonce
Response
200: OK

The original i.e returned response in step 1 (initiation step) looks like in the code block below. Pay attention to the nonce token which is a unique generated id for this transaction. You are required to sign this token and attach it back to the payload. Send back the payload with the signed nonce to the approval API.

Note: You are required to sign the nonce with the Private Key of the device used to initiate the payment. Note this is under the device_id parameter. On the IntaSend side, we'll verify the signature with the Public Key uploaded for use on the device.

Here are more details on how to sign the nonce.

{
"tracking_id": "c1acf08c-5cc1-4b3e-b4a8-e43bc068aa56",
"status": "Preview and approve",
"nonce": "1aiw02",
"device_id": 1,
"transactions": [
{
"status": "Pending",
"request_reference_id": "f6a5a8dc-e190-4707-8ea2-102919709a72",
"name": null,
"account": 254723890353,
"amount": 10000,
"narrative": null
}
...
],
"charge_estimate": 140.0,
"total_amount_estimate": 20140.0,
...
}

Sample signed payload

{
"tracking_id": "c1acf08c-5cc1-4b3e-b4a8-e43bc068aa56",
"status": "Preview and approve",
"nonce": "<SIGNED-NONCE-HEX>",
"transactions": [
{
"status": "Pending",
"request_reference_id": "f6a5a8dc-e190-4707-8ea2-102919709a72",
"name": null,
"account": 254723890353,
"amount": 10000,
"narrative": null
}
],
"charge_estimate": 140.0,
"total_amount_estimate": 20140.0,
...
}