Create Subaccount

Create a new subaccount on your Terraswitch account.

POST {{ BASE_URL }}/v1/corporate/subaccount

Body Parameters

Property
Data Type
Description
Example
Required

name

string

The name of the subaccount

"Corporate NATS"

Yes

description

string

Your description for the subaccount

"This is a business partner"

No

accountNo

string

The recipient bank account number to settle money to.

"0125318431"

Yes

bankCode

string

The bank sort code for the account number provided. Use the List Banks endpoint.

"035"

Yes

email

string

The contact email for the subaccount

Yes

phoneNumber

string

The 11-digit phone number for the subaccount

"08137031202"

Yes

phoneCode

string

The dial country code for the phone number provided. Defaulted to "+234"

"+234"

Yes

split

object

The defined object to hold payment split data.

N/A

Yes

split.type

string

Type of split. This can either be percentage or flat

"percentage"

Yes

split.value

number

The value of the split. For percentage, range is between 1 - 100 and it cannot be more than 100.

10.05

Yes

import Axios from 'axios';

// set the api url
const API_URL = `${BASE_URL}/v1/corporate/subaccount`;

// define request body
const data = {
    name: "Corporate NATS", 
    description: "Corporate NATS subaccount for Terraswitch", 
    accountNo: "0125318431", 
    bankCode: "035", 
    email: "[email protected]", 
    phoneCode: "+234", 
    phoneNumber: "08137031202", 
    split: {
        type: "percentage",
        value: 10.05
    }
}

// make request using axios
Axios({
    method: "POST",
    url: `${API_URL}`,
    headers: {
        lg: 'en',
        ch: 'web'
        Authorization: `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
    },
    data: data
}).then((resp) => {
    console.log(resp)
}).catch((err) => {
    console.log(err)
})

Last updated