Terraswitch
  • Terraswitch - Get Started
  • Test & Live Environments
  • Onboarding as a Business
  • GUIDES
    • 🎾Authentication
    • 🧀Webhooks
    • 🫓Status & Responses
    • 🏉API Rate Limits
    • 🚀Transactions & Destinations
    • 🍊Testing Credentials
    • 🚐Crafting Metadata
  • API ENDPOINTS
    • Account
      • Get Account Details
      • Get Banks
      • Get Beneficiaries
      • Add Bank
      • Change Settlement Bank
    • Wallet
      • Get Wallet Details
      • Get Wallet Transactions
    • Collections
      • Checkout
        • Initialize Transaction
      • Transfer
        • Generate Account
      • Charge
        • Create Charge
        • Authorize Charge
        • Charge Authorization
      • Bank
        • Pay with Opay
    • Payout
      • Bank Transfer
      • Withdraw Money
    • Products
      • List Products
      • Search Products
      • Filter Products
      • Fetch Product
      • Create Product
      • Update Product
    • Subaccounts
      • List Subaccounts
      • Search Subaccounts
      • Filter Subaccounts
      • Fetch Subaccount
      • Create Subaccount
      • Update Subaccount
    • Payment Links
      • List Payment Links
      • List Payment Link Transactions
      • Search Payment Links
      • Filter Payment Links
      • Fetch Payment Link
      • Create Payment Link
      • Update Payment Link
      • Attach Payment Resource
      • Remove Subaccount
      • Enable Payment Link
      • Disable Payment Link
    • Invoices
      • List Invoices
      • Search Invoices
      • Filter Invoices
      • Fetch Invoice
      • Create Invoice
      • Update Invoice
      • Remove Invoice Item
    • Transactions
      • List Transactions
      • Search Transactions
      • Filter Transactions
      • Verify Transaction
    • Refunds
      • List Refunds
      • Fetch Refund
      • Create Refund
    • Bills Payment
      • List Mobile Networks
      • List Bill Categories
      • List Bill Sub-Categories
      • List Mobile Data Plans
      • Validate Biller
      • Validate Bill Status
      • Validate Top-Up Status
      • Buy Airtime
      • Buy Data
      • Pay Bill
    • Resources
      • List Banks
      • List Countries
      • Resolve Bank Account
Powered by GitBook
On this page
  1. API ENDPOINTS
  2. Subaccounts

Update Subaccount

Create a new subaccount on your Terraswitch account.

PUT {{ BASE_URL }}/v1/corporate/subaccount/{{code}}

Body Parameters

Property
Data Type
Description
Example
Required

name

string

The name of the subaccount

"Corporate NATS"

No

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"

No

bankCode

string

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

"035"

No

email

string

The contact email for the subaccount

"hello@corporatenats.com"

No

phoneNumber

string

The 11-digit phone number for the subaccount

"08137031202"

No

phoneCode

string

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

"+234"

No

split

object

The defined object to hold payment split data.

N/A

No

split.type

string

Type of split. This can either be percentage or flat

"percentage"

No

split.value

number

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

10.05

No

import Axios from 'axios';

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

// define request body
const data = {
    name: "Corporate NATS", 
    description: "Corporate NATS subaccount for terraswitch", 
    accountNo: "", 
    bankCode: "", 
    email: "", 
    phoneCode: "", 
    phoneNumber: "", 
    split: {
        type: "percentage",
        value: 10.99
    }
}

// make request using axios
Axios({
    method: "PUT",
    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)
})
{
    "error": false,
    "errors": [],
    "data": {
        "code": "VSA_6yhyzzkcHc",
        "isEnabled": true,
        "name": "Corporate NATS",
        "description": "Corporate NATS subaccount for terraswitch",
        "phoneNumber": "08137031202",
        "phoneCode": "+234",
        "email": "hello@corportenats.com",
        "inflow": {
            "value": 0,
            "count": 0
        },
        "split": {
            "value": 10.99,
            "type": "percentage"
        },
        "bank": {
            "accountNo": "0125318431",
            "accountName": "CONCREAP TECHNOLOGY SOLUTIONS LIMITED",
            "bankCode": "035",
            "legalName": "Wema Bank",
            "name": "wema bank"
        }
        "slug": "corporate-nats",
        "createdAt": "2024-01-12T03:00:09.675Z",
        "updatedAt": "2024-01-12T03:00:09.675Z",
    },
    "message": "successful",
    "status": 200
}
PreviousCreate SubaccountNextPayment Links

Last updated 5 months ago