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:

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.

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"
}