Introduction
These public endpoints are available to all merchants and require no API key. They list the countries and providers supported by HUB2.List of countries
curl --location --request GET 'https://api.hub2.io/data/countries' \
--header 'Environment: sandbox' \
--header 'Content-Type: application/json'
const url = 'https://api.hub2.io/data/countries';
const headers = {
'Environment': 'sandbox',
'Content-Type': 'application/json'
};
fetch(url, {
method: 'GET',
headers: headers
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log(data);
})
.catch(error => {
console.error('There was a problem with your fetch operation:', error);
});
import requests
url = 'https://api.hub2.io/data/countries'
headers = {
'Environment': 'sandbox',
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print('Error:', response.status_code)
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
URL url = new URL("https://api.hub2.io/data/countries");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Environment", "sandbox");
connection.setRequestProperty("Content-Type", "application/json");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} else {
System.out.println("Error: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
method query parameter (for example ?method=mobile_money).
See the API reference for full details.
Use the country code (BF, SN, etc.) in the country fields of payments and transfers.
List of providers
curl --location --request GET 'https://api.hub2.io/data/providers' \
--header 'Environment: sandbox' \
--header 'Content-Type: application/json'
const url = 'https://api.hub2.io/data/providers';
const headers = {
'Environment': 'sandbox',
'Content-Type': 'application/json'
};
fetch(url, {
method: 'GET',
headers: headers
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
console.log(data);
})
.catch(error => {
console.error('There was a problem with your fetch operation:', error);
});
import requests
url = 'https://api.hub2.io/data/providers'
headers = {
'Environment': 'sandbox',
'Content-Type': 'application/json'
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print('Error:', response.status_code)
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Main {
public static void main(String[] args) {
try {
URL url = new URL("https://api.hub2.io/data/providers");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Environment", "sandbox");
connection.setRequestProperty("Content-Type", "application/json");
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
} else {
System.out.println("Error: " + responseCode);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
country, method and names query parameters (for example ?country=CI&method=mobile_money). Only enabled providers are returned.
See the API reference for full details.
Use the provider name in the provider fields of payments and transfers. This field is case-insensitive.
