Integrating Multicurrency Wallets: A Deep Dive to Multi-currency Global Payouts
Developers
Product Knowledge

Integrating Multicurrency Wallets: A Deep Dive to Multi-currency Global Payouts

Phylis A

The demand for borderless financial transactions keeps increasing as the global economy becomes increasingly interconnected. More companies are increasingly hiring internationally to access a wider pool of talent, extend runway or hire one or two exceptional talents. With this, Multi-currency wallets have proved to be indispensable, offering businesses a flexibility in managing cross-border transactions and currency conversions. In response to this need, Chimoney offers access to Multi-Currency Wallets for businesses and developers to integrate into their Financial workflows, Products and Solutions.

About Chimoney’s Multicurrency Wallets

With Chimoney's Multi-Currency Wallets Businesses can fund, send and receive funds in various currencies i.e. USD, CAD, and NGN. Whether it's disbursing salaries to employees across different countries, settling invoices with international suppliers, or receiving payments from clients worldwide, these wallets provide users with the versatility they need to conduct transactions in their preferred currency.

The Chimoney Multi-Currency Wallets Infrastructure and API is specifically designed to facilitate the creation and management of multicurrency wallets, as well as seamless fund cross-currency global transfers between the wallets and other recipient channels, such as email and phone numbers.

In this article we’ll focus on only two endpoints:

  • Create a New Multi-Currency Wallet endpoint: This initiates the creation of a new multi-currency wallet for a user or Business.
  • Transfer from a multicurrency wallet to another wallet, an email, or a phone number endpoint: This allows for fund transfers between multi-currency wallets or to an email or phone number.

Real-World Scenario: Global Payroll Management

We’ll implement a sample integration for an Organization with a remote team or community members distributed globally. The company needs a streamlined way to pay employees in their local currencies, ensuring timely, compliant and transparent transactions. Integrating Chimoney's multi-currency wallets offers the following benefits:

  • Employees: Workers and Community members receive their salaries in their preferred currencies, eliminating the need to manage foreign exchange or hidden fees. This creates a positive experience and reduces confusion regarding pay.
  • Organization: The company benefits from reduced international transfer fees and simplified payment processing with compliance built in. Chimoney handles currency conversions efficiently, tax and compliance. The consolidated payment flow minimizes administrative overhead and ensures a streamlined reconciliation process for Finance teams.

Pre-requisites

  • Node.js and npm (or yarn) installed
  • A Chimoney developer account. Get Sandbox Access
  • Familiarity with Javascript development and HTTP requests

Before diving into the integration process, developers need to sign up for a Chimoney developer account and obtain their API keys, which we'll use to set the Authorization header in our API requests.

Integration Steps

To make HTTPS requests to the Chimoney API, we'll use the axios library. Install it using npm or yarn:

npm install axios

Or use fetch.

Creating a New Multi-Currency Wallet

The /v0.2/multicurrency-wallets/create endpoint allows you to create new multi-currency wallets for the employees and community members. Here's an example of a Node.js function that creates a wallet for an employee:

const axios = require('axios');

async function createWallet(userData) {
  const url = 'https://api.chimoney.io/v0.2/multicurrency-wallets/create';
  const apiKey = 'YOUR_API_KEY'; // Replace with your Chimoney API key

  const data = {
    name: "Jane Doe",
    email: "jane.doe@company.org"
  };

  const headers = {
    'Content-Type': 'application/json',
    'x-api-key': `${apiKey}`,
  };

  try {
    const response = await axios.post(url, data, { headers });
    if (response.status === 200) {
      console.log('Wallet created successfully!');
      console.log('Wallet ID:', response.data.id);
      return response.data.id;
    } else {
      console.error('Error creating wallet:', response.data.error);
      throw new Error(response.data.error);
    }
  } catch (error) {
    throw error;
  }
}

This function takes user data (name, email, etc.) as input and returns the newly created wallet ID upon successful creation. Remember to replace YOUR_API_KEY with your actual Chimoney API key.

Transferring Funds Between Wallets

The /v0.2/multicurrency-wallets/transfer endpoint enables you to automate international payroll payments to employee wallets. Here's an example function for processing remote employee payments and payments to international community members:

async function processPayroll(employeeWalletId, amount, originCurrency, destinationCurrency) {
  const url = 'https://api.chimoney.io/v0.2/multicurrency-wallets/transfer';
  const headers = {
    'Content-Type': 'application/json',
    'x-api-key': `${apiKey}`,
  };

  const senderWalletId = 'YOUR_COMPANY_WALLET_ID'; // Replace with your organization's wallet ID

  const data = {
    amountToSend: amount,
    originCurrency: originCurrency,
    receiver: employeeWalletId, // Use the employee's wallet ID as the receiver
    destinationCurrency: destinationCurrency,
  };

  try {
    const response = await axios.post(url, data, { headers });
    if (response.status === 200) {
      console.log('Payroll payment successful!');
      console.log('Transaction details:', response.data);
      // Handle successful payment, e.g., update payroll records
    } else {
      console.error('Error processing payroll payment:', response.data.error);
      // Handle payment error, e.g., log details, notify administrator
    }
  } catch (error) {
    console.error('Error sending payroll transfer request:', error);
    // Handle network errors or API issues
  }
}

// Example usage (assuming you have employee dat)
const employeeData = {
  name: 'Jane Doe',
  email: 'jane.doe@company.org',
};

createEmployeeWallet(employeeData)
  .then(employeeWalletId => {
    processPayroll(employeeWalletId, 1000, 'USD', 'EUR'); // Pay €1000 equivalent in USD
  })
  .catch(error => {
    console.error('An error occurred:', error);
  });

The function sends payroll payments from the organization's wallet to employee wallets. It constructs a request to Chimoney's API endpoint /v0.2/multicurrency-wallets/transfer, including necessary headers and data. Upon successful payment, transaction details are logged, otherwise, error messages are logged for failed transactions. You can adjust the sender's wallet ID (senderWalletId) to the specific organization's wallet ID.

The employee or community member is notified and they can cash out their Payment to their Bank Account, Wallet, or other local options.

Conclusion

In conclusion, integrating Chimoney's Global Multi-Currency Wallets offers businesses and developers a seamless solution for global financial transactions and the flexibility needed to thrive in today's interconnected world.

Last edited on:
Share Post
instagramtwitterlinkedin

Check out these other posts

Chimoney Partners with ISIC to Expand Global Benefits for Chimoney App Users
Announcements
Chimoney News
Community Building

Chimoney Partners with ISIC to Expand Global Benefits for Chimoney App Users

Phylis A