Skip to content

Collection Subaccounts

Abraham Olaobaju edited this page Aug 22, 2023 · 4 revisions

Overview

Flutterwave's split payments feature allows you to split an incoming payment between one or more bank accounts and a commission fee. This can be useful in many ways.

To use split payments, you'll need to first set up one or more subaccounts (the bank accounts you want to split to). Then when collecting payment, you can specify how you would like to split the money. Any funds you direct to them will be settled into their account based on your settlement cycle.

Create a Collection Subaccount

This document shows you how to create a subaccount on Flutterwave.

use Flutterwave\Service\CollectionSubaccount;

$payload = new Payload();
$payload->set("account_bank", "044");
$payload->set("account_number", "06900000" . mt_rand(25, 60));
$payload->set("business_name", "Mean Ventures");
$payload->set("split_type", "percentage");
$payload->set("split_value", "0.5"); // 50%
$payload->set("business_mobile", "09087930450");
$payload->set("business_email", "[email protected]");
$payload->set("country", "NG");
$service = new CollectionSubaccount();
$request = $service->create($payload);

Successful Response

[
  "id" => 2181,
  "account_number" => "0690000037",
  "account_bank" => "044",
  "full_name" => "Eternal Blue",
  "created_at" => "2020-05-31T00:40:15.000Z",
  "split_type" => "percentage",
  "split_value" => 0.5,
  "subaccount_id" => "RS_235E8F4E92A4048B57EA29B0E1B8F78B",
  "bank_name" => "ACCESS BANK NIGERIA"
]

Fetch all SubAccounts

List all collection SubAccounts on Flutterwave.

<?php
use Flutterwave\Service\CollectionSubaccount;

$service = new CollectionSubaccount();
$request = $service->list();
print_r($request);

Responses

Success
{
  "data": [
    ...
    {
      "id": 2164,
      "account_number": "0690000043",
      "account_bank": "044",
      "business_name": "JK Services",
      "full_name": "Roberta Weber",
      "created_at": "2020-01-17T16:25:36.000Z",
      "meta": [
        {}
      ],
      "account_id": 88496,
      "split_ratio": 1,
      "split_type": "flat",
      "split_value": 0,
      "subaccount_id": "RS_A560B61FF493A3720913B0487030D2A5",
      "bank_name": "ACCESS BANK NIGERIA",
      "country": "NG"
    },
    {
      "id": 1962,
      "account_number": "0690000042",
      "account_bank": "044",
      "business_name": "Sam Son",
      "full_name": "Forrest Terry",
      "created_at": "2019-12-09T13:27:04.000Z",
      "meta": [
        {
          "swift_code": ""
        }
      ],
      "account_id": 84353,
      "split_ratio": 1,
      "split_type": "percentage",
      "split_value": 0.02,
      "subaccount_id": "RS_008F29575D91B6E80BB31F5B374CBF4E",
      "bank_name": "ACCESS BANK NIGERIA",
      "country": "NG"
    },
    ...
  ]
}
Failed
{}

Fetch a SubAccount.

Fetch a collection SubAccount on Flutterwave.

use Flutterwave\Service\CollectionSubaccount;

$service = new CollectionSubaccount();
$request = $service->get($id);

Update a SubAccount.

Update a collection SubAccount on Flutterwave.

use Flutterwave\Service\CollectionSubaccount;
use Flutterwave\Payload;

$payload = new Payload();
$payload->set("split_value", "0.2");
$service = new CollectionSubaccount();
$request = $service->update($id, $payload);
print_r($request);

Delete a SubAccount.

Delete a collection SubAccount on Flutterwave.

use Flutterwave\Service\CollectionSubaccount;

$service = new CollectionSubaccount();
$request = $service->delete($id);
print_r($request);