Pay with MoMo
Allow users to make payments using MTN Ghana Momo, AirtelTigo and Vodafone (Telecel)
Last updated
<?php
$curl = curl_init();
$data = [
'transaction_id' => 'TXN-202607020001',
'business_code' => '25754643',
'currency' => 'GHS',
'payment_method_id' => 'mtnghana', //airteltigoghana, vodafoneghana
'amount' => 100.00,
'payment_details' => [
'momo_number' => '+233240000000',
'otp' => '123456',
'customer_email' => '[email protected]',
'customer_firstname' => 'Kofi',
'customer_lastname' => 'Narh',
],
];
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.xtrakit.com/api/v1/momo/pay',
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 => $data,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer API_KEY', // Replace 'API_KEY' with your actual API key
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>const axios = require("axios");
const data = {
transaction_id: "TXN-202607020001",
business_code: "264356434",
currency: "GHS",
payment_method_id: 'mtnghana', //airteltigoghana, vodafoneghana
amount: 100.00,
payment_details: {
momo_number: "+233240000000",
otp: "123456",
customer_email: "[email protected]",
customer_firstname: "Kofi",
customer_lastname: "Narh"
}
};
axios.post("https://api.xtrakit.com/api/v1/momo/pay", data, {
headers: {
Authorization: `Bearer ${process.env.XTRAPAY_API_KEY}`,
"Content-Type": "application/json"
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error(error.response?.data || error.message);
});{
"status": "000",
"data": {
"transaction_id": "TXN-202607020001",
"merchant_transaction_id": "44b8daae-5e66-6280-8aa2-e41c73d5e43b",
"momo_number": "+233539421088",
"amount": "1.00",
"currency": "GHS",
"payment_method_name": "mtnghana", //airteltigoghana, vodafoneghana
"status": "pending",
"fee": "0.00",
"created_at": "2026-07-02T22:12:37.000000Z"
},
"message": "Payment is being processed"
}{
"status": 401,
"error": "Unauthorized: Missing Bearer Token"
},
{
"status": 401,
"error": "Unauthorized: Invalid API Key"
}