Language

Step 1: Create PAY recipients using the Kopo Kopo API

Your partners (customers, suppliers etc.) have an account or a relationship with your application. Your application holds their bank account or mobile wallet information. You can add Pay recipients directly in your Kopo Kopo merchant account or by using the API as prescribed below.

Step 1A. Obtain an application access token

Your application will exchange its client_id, client_secret, and grant_type=client_credentials for an application access token. An application access token can then be used to make calls to the API on behalf of your application.

Step 1B. Create a PAY recipient

Create a ‘pay recipient’ for every person you would like to make payments to. You can create recipients whose funds destinations are mobile wallets, bank accounts, other Kopo Kopo merchants and other till numbers. More details can be found in the Api docs

POST https://sandbox.kopokopo.com/api/v1/pay_recipients
Content-Type: application/json
Accept: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
{
  "type": "mobile_wallet"
  "pay_recipient" : {
    "first_name": "John",
    "last_name": "Doe",
    "email": "johndoe@nomail.net",
    "phone_number": "+254999999999",
    "network: "Safaricom"
  }
}

HTTP/1.1 201 Created
Location: https://sandbox.kopokopo.com/api/v1/pay_recipients/c7f300c0-f1ef-4151-9bbe-005005aa3747
mobile_input = {
    type: "mobile_wallet", 
    first_name: "John", 
    last_name: "Doe", 
    email: "johndoe@nomail.net", 
    phone_number: "+254999999999", 
    network: "Safaricom" 
}

# Using k2-connect - https://github.com/kopokopo/k2-connect-ruby(Recommended)
k2_pay = K2Pay.new('your_access_token')
# Mobile wallet recipient
k2_pay.add_recipient(mobile_input)
k2_pay.recipients_location_url # => "https://sandbox.kopokopo.com/pay_recipients/c7f300c0-f1ef-4151-9bbe-005005aa3747"
const PayService = K2.PayService

var requestBody = {
  type: 'mobile_wallet',
  firstName: 'John',
  lastName: 'Doe',
  network: 'Safaricom',
  email: 'johndoe@nomail.net',
  phoneNumber: '+254999999999',
  accessToken: 'myRand0mAcc3ssT0k3n'
}

PayService
  .addPayRecipient(requestBody)
  .then(function(res) {
    console.log(response)// => 'https://sandbox.kopokopo.com/api/v1/pay_recipients/c7f300c0-f1ef-4151-9bbe-005005aa3747'
  })
  .catch( error => {
    console.log(error)
  })

mobile_pay = {
  'access_token': ACCESS_TOKEN,
  'recipient_type': 'mobile_wallet',
  "first_name": "mobile_wallet_first_name",
  "last_name": "mobile_wallet_last_name",
  "phone_number": "+254123456789",
  "network": "mobile_wallet_network",
  "email": "test@test.com"
}


# Using k2-connect - https://github.com/kopokopo/k2-connect-python (Recommended)
k2connect.initialize(CLIENT_ID, CLIENT_SECRET, BASE_URL)
pay_service = k2connect.Pay

# Add mobile wallet pay recipient
mobile_wallet_resource_url = pay_service.add_pay_recipient(mobile_pay)
<?
$pay = $K2->PayService();

$response = $pay->addPayRecipient([
  'type' => 'mobile_wallet',
  'firstName'=> 'John',
  'lastName'=> 'Doe',
  'email'=> 'johndoe@nomail.net',
  'phoneNumber'=> '+254999999999',
  'network'=> 'Safaricom',
  'accessToken' => 'myRand0mAcc3ssT0k3n'
]);

if($response['status'] == 'success')
{
    echo "The resource location is:" . json_encode($response['location']);
}
//Get Java sample

When the PAY recipient is created, you’ll receive the Pay Recipient URL in the location header.

Please note, PAY recipients can also be created by logging into your Kopo Kopo account and creating them directly in the platform as opposed to via the API.

Step 1C. Bank account validation rules

Different banks have different account number formats. To ensure successful bank payments, make sure to follow the validation rules below.

Bank NameA/C No. Character LimitFormatCommentCopy for validation failure messages
Absa10digitsNumbers only. No letters. No special characters.Absa Bank account numbers must be 10 digits long.
Co-operative Bank14digitsNumbers only. No letters. No special characters.Co-operative Bank account numbers must be 14 digits long.
Family Bank12digitsNumbers only. No letters. No special characters.Family Bank account numbers must be 12 digits long.
I&M Bank14digitsNumbers only. No letters. No special characters.I&M Bank account numbers must be 14 digits long.
KCB10digitsNumbers only. No letters. No special characters.Kenya Commercial Bank account numbers must be 10 digits long.
Middle East Bank (MEB)13digitsNumbers only. No letters. No special characters.Middle East Bank account numbers must be 13 digits long.
National Bank of Kenya14digitsNumbers only. No letters. No special characters.National Bank of Kenya account numbers must be 14 digits long.
NCBA10 OR 12digitsNumbers only. No letters. No special characters. Either 10 or 12. No 11.NCBA account numbers must be 10 or 12 digits long.
Prime Bank10digitsNumbers only. No letters. No special characters.Prime Bank account numbers must be 10 digits long.
SBM Bank13digitsNumbers only. No letters. No special characters.SBM Bank account numbers must be 13 digits long.
Sidian Bank14digitsNumbers only. No letters. No special characters.Sidian Bank account numbers must be 14 digits long.
Stanbic13digitsNumbers only. No letters. No special characters.Stanbic Bank account numbers must be 13 digits long.
Standard Chartered13digitsNumbers only. No letters. No special characters.Standard Chartered account numbers must be 13 digits long.