Language

Step 2: Create a Verified Settlement Account via API

You can create settlement accounts by either

  • Logging into your Kopo Kopo merchant account and adding settlement accounts in the Account Settings section or
  • Via the Kopo Kopo Connect API as detailed below.

We will create a Bank Account

The following information is required for a Verified Bank Account. In this example we will be creating a Merchant Bank Account as a destination of your funds.

POST https://sandbox.kopokopo.com/merchant_bank_accounts
Content-Type: application/json
Accept: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
{
  "account_name": "Jane Merchant",
  "bank_ref": "9ed38155-7d6f-11e3-83c3-5404a6144203",
  "bank_branch_ref": "9ed38155-7d6f-11e3-83c3-5404a6144203",
  "account_number": "1234567890",
  "settlement": "EFT"
}

HTTP/1.1 201 Created
Location: https://sandbox.kopokopo.com/merchant_bank_accounts/AB443D36-3757-44C1-A1B4-29727FB3111C
settlement_account = {
  type: 'merchant_bank_account',
  account_name: 'account_name',
  bank_branch_ref: 'bank_branch_ref',
  account_number: 'account_number',
  settlement_method: 'settlement_method'
}

# Using K2Connecct - https://github.com/kopokopo/k2-connect-ruby (Recommended)
k2_settlement.add_settlement_account(settlement_account)
k2_settlement.location_url # => "https://sandbox.kopokopo.com/api/v1/merchant_wallets/AB443D36-3757-44C1-A1B4-29727FB3111C"
var requestBody = {
  'accountName': 'John Doe',
  'bankBranchRef': 'c7f300c0-f1ef-4151-9bbe-005005aa3747',
  'accountNumber': '123456789',
  'settlementMethod': 'EFT',
  'accessToken': 'myRand0mAcc3ssT0k3n'
}

//  Using Kopo Kopo Connect - https://github.com/kopokopo/k2-connect-node (Recommended)
const TransferService = K2.TransferService

TransferService
  .createMerchantBankAccount(requestBody)
  .then( response => {
    console.log(response) // => 'https://sandbox.kopokopo.com/api/v1/merchant_bank_accounts/d76265cd-0951-e511-80da-0aa34a9b2388'
  })
  .catch( error => {
    console.log(error)
  })
# Using K2Connect - https://github.com/kopokopo/k2-connect-python (Recommended)
k2connect.initialize(CLIENT_ID, CLIENT_SECRET, BASE_URL)
transfer_service = k2connect.Transfers

# create verified settlement mobile account

request_body ={
  "access_token": ACCESS_TOKEN,
  "first_name": 'py_sdk_first_name',
  "last_name": 'py_sdk_last_name',
  "phone_number": '+254911222538',
  "network": 'Safaricom'
}

mobile_settlement_account = transfer_service.add_mobile_wallet_settlement_account(request_body)
mobile_settlement_account # => "https://sandbox.kopokopo.com/api/v1/merchant_wallets/AB443D36-3757-44C1-A1B4-29727FB3111C"
<?
//  Using Kopo Kopo Connect - https://github.com/kopokopo/k2-connect-php (Recommended)
$transfer = $K2->SettlementTransferService();

$response = $transfer->createMerchantBankAccount([
    'accountName' => 'John Doe',
    'bankBranchRef' => 'c7f300c0-f1ef-4151-9bbe-005005aa3747',
    'accountNumber' => '123456789',
    'settlementMethod' => 'EFT',
    'accessToken' => 'myRand0mAcc3ssT0k3n'
]);

if($response['status'] == 'success')
{
    echo "The resource location is:" . json_encode($response['location']);
}
// Not Supported
// This feature is not currently available in the Flutter SDK.
// Please use one of the other SDKs (PHP, Ruby, Python, NodeJs) or the REST API.

When the bank account is created, you’ll receive the merchant bank account URL in the location header.