Create Virtual Accounts with Atlas
Create Virtual Accounts with Atlas
Step-by-step guide to creating a customer with a dedicated virtual account.
This guide walks you through creating a customer on Atlas and automatically provisioning a virtual bank account for that customer. Once created, the virtual account can be used to receive transfers and track customer-specific payments.
Prerequisites
To follow this guide, you need the following:
- A verified Atlas account. If you don't have one, you can sign up for free and follow this guide to verify your Atlas account.
- An Atlas API Key. You can fetch your API Key from your Atlas dashboard.
- Configured and setup webhooks on Atlas. See our guide on Configuring and Verifying Atlas webhooks.
Creating a virtual account
To create a virtual account, you first need to create a customer. Atlas provisions a wallet and virtual account for the customer when has_wallet is set to true in the request. To create a customer, make a POST request to the Create Customer endpoint with the following fields.
email: The customer's email address. This field is required.phone: The customer's phone number in international format (e.g.+2347012345678). This field is required.type: This can either"individual"or"business". It controls whose name appears on the virtual account. Individual accounts resolve to the customer's name and business accounts resolve to your business name.first_name: The customer's first name. It is required whentypeis"individual".last_name: The customer's last name. It is required whentypeis"individual".has_wallet: Set totrueto provision a virtual account for the customer. Defaults tofalse.
We recommend encrypting the payload before sending it.
Example Code:
JavaScript
const axios = require("axios");
const createCustomer = async () => {
try {
const response = await axios.post(
"https://atlas.tryduplo.com/api/v1/customer",
{
first_name: "John",
last_name: "Doe",
email: "john.doe@example.com",
phone: "+2347012345678",
type: "individual",
has_wallet: true,
},
{
headers: {
Authorization: "Bearer your_api_key",
"Content-Type": "application/json",
Accept: "application/json",
},
},
);
// Access the wallet object
const wallet = response.data?.data?.wallet;
console.log(wallet);
} catch (error) {
console.error(error.response?.data);
}
};
createCustomer();
Expected Response:
{
"wallet_id": "469e02df-43ae-46e7-8ebc-0b0ab5e19303",
"currency": "NGN",
"wallet_type": "customer",
"account_number": "6754358291",
"account_name": "dp_pay/wilkinson, sawayn and sch/wilkinson, sawayn and schroeder ltd",
"provider": "duplo"
}