Try It Out
Please set your authentication token in the sidebar to test this API.
Headers
Request Body
Code Samples
curl -X POST \
'https://upesipay.com/api/v2/topup?wallet_type=service_wallet' \
-H 'Authorization: Basic YOUR_AUTH_TOKEN' \
-H 'Content-Type: application/json' \
-d '{{"amount":100,"phone_number":"0787677676"}}'
const url = 'https://upesipay.com/api/v2/topup?wallet_type=service_wallet';
const options = {
method: 'POST',
headers: {
'Authorization': 'Basic YOUR_AUTH_TOKEN',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: 100,
phone_number: '0787677676'
})
};
fetch(url, options)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
const axios = require('axios');
const config = {
method: 'post',
url: 'https://upesipay.com/api/v2/topup?wallet_type=service_wallet',
headers: {
'Authorization': 'Basic YOUR_AUTH_TOKEN',
'Content-Type': 'application/json'
},
data: {
amount: 100,
phone_number: '0787677676'
}
};
axios(config)
.then(response => console.log(response.data))
.catch(error => console.error(error));
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://upesipay.com/api/v2/topup?wallet_type=service_wallet',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode(array(
'amount' => 100,
'phone_number' => '0787677676'
)),
CURLOPT_HTTPHEADER => array(
'Authorization: Basic YOUR_AUTH_TOKEN',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
echo $response;
import requests
url = 'https://upesipay.com/api/v2/topup?wallet_type=service_wallet'
headers = {
'Authorization': 'Basic YOUR_AUTH_TOKEN',
'Content-Type': 'application/json'
}
data = {
'amount': 100,
'phone_number': '0787677676'
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
var client = HttpClient.newHttpClient();
var body = "{\"amount\":100,\"phone_number\":\"0787677676\"}";
var request = HttpRequest.newBuilder()
.uri(URI.create('https://upesipay.com/api/v2/topup?wallet_type=service_wallet'))
.header('Authorization', 'Basic YOUR_AUTH_TOKEN')
.header('Content-Type', 'application/json')
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import (
"fmt"
"net/http"
"io"
"bytes"
)
data := []byte(`{{"amount":100,"phone_number":"0787677676"}}`)
req, _ := http.NewRequest("POST", "https://upesipay.com/api/v2/topup?wallet_type=service_wallet", bytes.NewBuffer(data))
req.Header.Set("Authorization", "Basic YOUR_AUTH_TOKEN")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
require 'net/http'
require 'json'
uri = URI('https://upesipay.com/api/v2/topup?wallet_type=service_wallet')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Basic YOUR_AUTH_TOKEN'
request['Content-Type'] = 'application/json'
request.body = JSON.generate({ amount: 100, phone_number: '0787677676' })
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
response = http.request(request)
puts JSON.parse(response.body)
using System;
using System.Net.Http;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
var body = new { amount = 100, phone_number = "0787677676" };
var content = new StringContent(JsonSerializer.Serialize(body), System.Text.Encoding.UTF8, "application/json");
var request = new HttpRequestMessage(HttpMethod.Post, "https://upesipay.com/api/v2/topup?wallet_type=service_wallet") { Content = content };
request.Headers.Add("Authorization", "Basic YOUR_AUTH_TOKEN");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
import Foundation
let url = URL(string: "https://upesipay.com/api/v2/topup?wallet_type=service_wallet")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Basic YOUR_AUTH_TOKEN", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
let body = ["amount": 100, "phone_number": "0787677676"]
request.httpBody = try? JSONSerialization.data(withJSONObject: body)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
if let json = try? JSONSerialization.jsonObject(with: data) {
print(json)
}
}
}
task.resume()
import okhttp3.*
import java.io.IOException
val client = OkHttpClient()
val body = """{{"amount":100,"phone_number":"0787677676"}}""".toRequestBody("application/json".toMediaType())
val request = Request.Builder()
.url("https://upesipay.com/api/v2/topup?wallet_type=service_wallet")
.addHeader("Authorization", "Basic YOUR_AUTH_TOKEN")
.post(body)
.build()
client.newCall(request).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {
e.printStackTrace()
}
override fun onResponse(call: Call, response: Response) {
println(response.body?.string())
}
})