The Chimoney API's Account Endpoints allow for the management of user accounts and transactions, from retrieving transaction details to transferring funds between accounts. These endpoints are essential for verifying transaction status, ensuring record accuracy, and resolving disputes in transactions, which ultimately enhances customer support and financial management. Additionally, they facilitate user interaction through public profile retrieval, allowing users to share their social and payment links.
This article will guide you through using the Chimoney API's Account Endpoints to manage user accounts and transactions. You'll learn how to retrieve transaction details, transfer funds, and handle other essential operations to enhance customer support and financial management in your application.
Before we begin, ensure you have the following:
If you haven't set up your Chimoney developer account yet, refer to our previous article on how to get started with the Chimoney API.
The Account Endpoints are designed to handle various operations related to user accounts and transactions. Here’s a brief overview of the Account Endpoints:
In this section, we will explore how to integrate each of the Chimoney API's Account Endpoints into your application.
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.
Endpoint: POST /v0.2/accounts/issue-id-transactions
This endpoint allows you to retrieve the details of a specific transaction using its issueID. This is particularly useful when you need to verify the status or details of a transaction after it has been initiated.
Application
Before we get started, you need to have an issueID. To get it you can initiate a test payout by following these steps:
Recipient email address
, Amount in USD to send
.The code below makes a POST request to the Chimoney API using the Axios library in JavaScript. It sets up the request options in the options object and specifies the method as 'POST'. It provides the URL for the Chimoney API endpoint: https://api-v2-sandbox.chimoney.io/v0.2/accounts/issue-id-transactions. You will need to add your issueID at the end of this URL.
In the headers, include 'accept' as application/json
, 'content-type' as application/json
, and 'X-API-KEY' with your actual API key.
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://api-v2-sandbox.chimoney.io/v0.2/accounts/issue-id-transactions?issueID= ' //Enter issueID,
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-KEY': ' ' //Enter your API Key
}
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
The response will include details of the specified transaction, such as the transaction amount, status, date, and any associated metadata.
Endpoint: POST /v0.2/accounts/public-profile
This endpoint allows you to retrieve the public profile information of a Chimoney user including social media links. Example public profile page
Application
Copy and paste the code below into your project where you need to make the API request. Replace 'user-id' in the data object with the actual user ID you want to query.
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://api-v2-sandbox.chimoney.io/v0.2/accounts/public-profile',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-KEY': '_YOUR_API_KEY_'
},
data: { userId: ' ' } //Enter userID
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
The response will contain the public profile information of the specified user, including their payment data
, social media links
, username
and any other publicly available details.
Endpoint: POST /v0.2/accounts/transactions
This endpoint allows you to retrieve all transactions associated with a specific account. This is useful for generating account statements or for reviewing transaction history.
Application
Enter the accountID whose transaction details you want to retrieve.
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://api-v2-sandbox.chimoney.io/v0.2/accounts/transactions',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-KEY': '_YOUR_API_KEY_'
},
data: { accountId: ' ' } //Enter accountID
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
The response will list all transactions associated with the specified account, including details such as transaction IDs, dates, amounts, and statuses.
Endpoint: POST /v0.2/accounts/transaction
This endpoint allows you to retrieve the details of a single transaction using its transactionID. This is particularly useful for verifying individual transactions and ensuring they were processed correctly.
Application
Enter the Transaction ID [t_ID] of the specific transaction whose details you want to retrieve.
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://api-v2-sandbox.chimoney.io/v0.2/accounts/transaction',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-KEY': '_YOUR_API_KEY_'
},
data: { transactionID: 'transaction-id' }
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
The response will include detailed information about the specified transaction, such as the transaction amount, date, status, and any associated metadata.
Endpoint: POST /v0.2/accounts/transfer
This endpoint allows you to transfer funds from one account to another. This can be used for various purposes such as internal fund transfers or sending money to another user within your application.
Application
Enter the recipient's ID for the person you intend to pay out to.
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://api-v2-sandbox.chimoney.io/v0.2/accounts/transfer',
headers: {
accept: 'application/json',
'content-type': 'application/json',
'X-API-KEY': ' ' //Enter _YOUR_API_KEY_
},
data: {receiver: ' '} //Enter the recipient's ID
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
The response will confirm the successful transfer of funds between the specified accounts, including details such as the payment link
, redeem data
, status
, transfer amount
, payment date
.
Endpoint: POST /v0.2/acconts/delete-unpaid-transactions
This endpoint allows you to delete an unpaid transaction using its transactionID. This is useful for cleaning up pending transactions that were not completed or need to be canceled.
Application
const axios = require('axios');
const options = {
method: 'DELETE',
url: 'https://api-v2-sandbox.chimoney.io/v0.2/accounts/delete-unpaid-transaction?chiRef= ', //Enter chiRef ID
headers: {
accept: 'application/json',
'X-API-KEY': ' ' //Enter YOUR_API_KEY
}
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
The response will confirm the successful deletion of the specified unpaid transaction, ensuring that it is removed from the transaction history.
By following the provided examples and explanations, you should now be able to integrate these Chimoney Accounts endpoints into your application easily.
Stay tuned for the next article in this series, where we will explore the AI endpoint of the Chimoney API. If you have any questions or need further assistance, please reach out to us at support@chimoney.io.
Happy coding with the Chimoney API!