Create a Virtual Account Number (virtual nuban)
All requests to/virtual-nubanswill be routed based on your payload:
- If virtualAccountDetails is included, a reserved account will be created.
- If virtualAccountDetail is not included, an account number will be generated.
To create a virtual account number, make a POST request to the /api/v1/virtual-nubans endpoint.
| Verb | URL | 
|---|---|
| POST | {{baseUrl}}/api/v1/virtual-nubans | 
You be required to pass the settlementAccount which is the account that will receive the money. This settlement account can either be a deposit account or a subaccount.
By default, a virtual account number is created when you create a deposit account.
Sample request to create virtual nuban and sample 200 OK response are given below:
curl --request POST \
     --url https://api.sandbox.getanchor.co/api/v1/virtual-nubans \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-anchor-key: <API Key>' \
     --data '
{
  "data": {
    "type": "VirtualNuban",
    "relationships": {
      "settlementAccount": {
        "data": {
          "type": "DepositAccount",
          "id": "170125569082617-anc_acc"
        }
      }
    }
  }
}
'{
  "data": {
    "id": "17017851753571-anc_va",
    "type": "VirtualNuban",
    "attributes": {
      "createdAt": "2023-12-05T14:06:15.424834",
      "bank": {
        "id": "1656585494013221-anc_bk",
        "name": "PROVIDUS BANK",
        "nipCode": "000023"
      },
      "isDefault": false,
      "accountName": "Great Busness",
      "permanent": true,
      "currency": "NGN",
      "accountNumber": "4408719066",
      "status": "ACTIVE"
    },
    "relationships": {
      "settlementAccount": {
        "data": {
          "id": "170125569082617-anc_acc",
          "type": "DepositAccount"
        }
      },
      "customer": {
        "data": {
          "id": "16976298908802-anc_bus_cst",
          "type": "BusinessCustomer"
        }
      }
    }
  }
}Create Virtual Nuban and Pass a Provider
curl --request POST \
     --url https://api.sandbox.getanchor.co/api/v1/virtual-nubans \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-anchor-key: <API Key>' \
     --data '
{
  "data": {
    "type": "VirtualNuban",
    "attributes": {
      "provider": "providus"
    },
    "relationships": {
      "settlementAccount": {
        "data": {
          "type": "DepositAccount",
          "id": "170125569082617-anc_acc"
        }
      }
    }
  }
}
'{
  "data": {
    "id": "17017850484420-anc_va",
    "type": "VirtualNuban",
    "attributes": {
      "createdAt": "2023-12-05T14:04:08.560685",
      "bank": {
        "id": "1656585494013221-anc_bk",
        "name": "PROVIDUS BANK",
        "nipCode": "000023"
      },
      "isDefault": false,
      "accountName": "Great Busness",
      "permanent": true,
      "currency": "NGN",
      "accountNumber": "5285878828",
      "status": "ACTIVE"
    },
    "relationships": {
      "settlementAccount": {
        "data": {
          "id": "170125569082617-anc_acc",
          "type": "DepositAccount"
        }
      },
      "customer": {
        "data": {
          "id": "16976298908802-anc_bus_cst",
          "type": "BusinessCustomer"
        }
      }
    }
  }
}Create Virtual Nuban and Pass Customer Details
You can create a virtual account number and pass customer details. Note that, you will be required to provide the name and the BVN of the customer.
| Field | Required? | Description | 
|---|---|---|
| name | Yes | This is the name you would want the virtual account number to bear. | 
| bvn | Yes | This is the bvn that will be linked to the user of this virtual account number. | 
| email | No | This is the email of the customer. | 
| permanent | No | This specifies if the virtual account number is permanent or not. | 
| reference | No | The unique reference for the virtual account number. | 
| description | No | The short description for the virtual account number. | 
Below is a sample payload to create a virtual account number (virtual Nuban) and a sample 200 OK response.
curl --request POST \
     --url https://api.sandbox.getanchor.co/api/v1/virtual-nubans \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-anchor-key: <API Key>' \
     --data '
{
  "data": {
    "attributes": {
      "virtualAccountDetail": {
        "name": "Bright Chimezie",
        "bvn": "22222222226",
        "email": "[email protected]",
        "permanent": true,
        "reference": "12345",
        "description": "Virtul Nuban created in the office"
      },
      "provider": "providus"
    },
    "relationships": {
      "settlementAccount": {
        "data": {
          "type": "DepositAccount",
          "id": "16922123754372-anc_acc"
        }
      }
    },
    "type": "VirtualNuban"
  }
}
'{
  "data": {
    "id": "170185289624315-anc_va",
    "type": "VirtualNuban",
    "attributes": {
      "createdAt": "2023-12-06T08:54:56.327037",
      "bank": {
        "id": "1656585494013221-anc_bk",
        "name": "PROVIDUS BANK",
        "nipCode": "000023"
      },
      "isDefault": false,
      "accountName": "Bright Chimezie",
      "permanent": true,
      "currency": "NGN",
      "accountNumber": "2415160341",
      "status": "ACTIVE"
    },
    "relationships": {
      "settlementAccount": {
        "data": {
          "id": "16922123754372-anc_acc",
          "type": "DepositAccount"
        }
      },
      "customer": {
        "data": {
          "id": "16922123736510-anc_bus_cst",
          "type": "BusinessCustomer"
        }
      }
    }
  }
}Updated 3 months ago