Cross-border payments have become increasingly popular and essential in today's global economy, benefiting both businesses and individuals. The Chimoney API addresses this need by offering payout and payment infrastructure. By using Chimoney, you can streamline cross-border payments, improve user experience, and expand your reach to over 130 countries.
This article showcases the key features of the Chimoney API and guides you through making your first Chimoney API call. For detailed examples and specific use cases, check out these blogs:
Additionally, read about how Reeple is using our API for remittances to Africa in this customer success story.
At its core, Chimoney is a provider of payment and payout infrastructure and an API, offering seamless cross-border payment solutions. Imagine a world where everyone, regardless of location or economic status, can easily receive payments and redeem them through international bank transfers, gift cards, airtime, and Mobile Money. This is precisely what Chimoney offers.
APIs (Application Programming Interfaces) act as bridges allowing applications to communicate with each other. The Chimoney API enables the integration of Chimoney’s services into applications through various endpoints. It provides essential functionalities to streamline cross-border payments and improve user payment experiences via:
The Chimoney API is organized into several categories, each offering different Chimoney services:
In this section, we'll guide you through the process of creating a Chimoney developer account, obtaining an API key, and initiating an API call with the Chimoney API.
To begin integrating with the Chimoney API, you'll first need to create a developer account on the Chimoney platform. Follow these steps to get started:
Visit the Chimoney Developer Portal: Navigate to the Chimoney Developer Portal at sandbox.chimoney.io.
Create Account: Click on create account to create your developer account and fill in your email address, and a password.
Verify Your Email: After signing up, Chimoney will send a verification email to the address you provided. Click the verification link in the email to confirm your account.
Complete Your Profile: Once verified, log in to your Chimoney developer account and complete your onboarding. You can also opt to complete later by clicking on the complete later button on the top right of the page.
An API key is required to authenticate and authorize API requests to Chimoney. Here’s how you can obtain your API key:
Now that you have your API key, you’re ready to start making API calls to Chimoney endpoints. Here’s a basic example of how to initiate an API call using Node.js:
First, you need to install the Axios in your project. You can do this using the following command:
npm install axios
After setting up your environment and installing Axios, you are ready to make your first call to the Chimoney API. The next step is to send a POST request to the Chimoney Payout Chimoney endpoint, which allows the initiation of payouts. We'll explain each part of the code to ensure you understand how it works.
Start by importing the Axios library in your JavaScript file. Axios is a promise-based HTTP client for the browser and Node.js, which makes it easy to send asynchronous HTTP requests.
const axios = require('axios');
Define the options for the API request. The options include the HTTP method, the URL of the API endpoint, the headers, and the data to be sent.
Method: Specify the HTTP method as 'POST' because we are sending data to create a new resource (initiate a payout).
URL: Set the URL to the Chimoney Payout endpoint: https://api-v2-sandbox.chimoney.io/v0.2/payouts/chimoney.
Headers: Include the necessary headers:
Data: The data object contains the parameters required by the API. For the payout endpoint, you need to specify the recipient's email
and the amount in USD
. This data will be sent in the body of the POST request.
const options = {
method: 'POST',
url: 'https://api-v2-sandbox.chimoney.io/v0.2/payouts/chimoney',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-KEY': '_YOUR_API_KEY_'
},
data: {
chimoneys: [
{
email: 'test@gmail.com',
valueInUSD: 10
}
]
}
};
Note: Ensure you are calling the correct endpoint URL (sandbox or production). If you encounter issues, kindly verify that the appropriate endpoint is being used.
Use Axios to send the request with the configured options. The .request
method sends the HTTP request and returns a promise.
Then Method: The .then
method is used to handle the response when the request is successful. The response data is logged to the console.
Catch Method: The .catch
method is used to handle any errors that occur during the request. The error is logged to the console.
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
Here’s the complete example code with additional comments to explain each part:
// Import the Axios library
const axios = require('axios');
// Configure the request options
const options = {
method: 'POST', // HTTP method to use
url: 'https://api-v2-sandbox.chimoney.io/v0.2/payouts/chimoney', // API endpoint URL
headers: { // HTTP headers to include
accept: 'application/json', // Accept JSON response
'content-type': 'application/json', // Sending JSON data
'X-API-KEY': '_YOUR_API_KEY_' // Your Chimoney API key
},
data: { // Data to send in the request body
chimoneys: [
{
email: 'test@gmail.com', // Recipient's email
valueInUSD: 10 // Amount to payout in USD
}
]
}
};
// Send the API request
axios
.request(options)
.then(function (response) { // Handle successful response
console.log(response.data); // Log the response data
})
.catch(function (error) { // Handle error
console.error(error); // Log the error
});
When the API call is successful, you should see a response object in the console with details of the payout transaction like the example below
If there is an error (e.g., invalid API key, incorrect endpoint URL), the error details will be logged to the console.
In the upcoming articles, we’ll explore the Chimoney API endpoints in greater detail. This concludes our initial setup guide for integrating with the Chimoney API. If you encounter any issues or have questions during the setup process, please reach out to us at support@chimoney.io for assistance.
Happy coding with the Chimoney API!