Language

Step 3B: Create a ‘targeted’ transfer

Create a transfer by specifying the amount and the destination of where your funds will be transferred to.

POST https://sandbox.kopokopo.com/api/v1/settlement_transfers
Accept: application/json
Content-Type: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
{
  "amount": {
    "currency": "KES",
    "value": "2250.00"
  },
  "destination_type": "merchant_bank_account",
  "destination_reference": "d76265cd-0000-e511-80da-0aa34a9b0000",
  "_links": {
    "callback_url": "https://your-call-bak.yourapplication.com/transfer_result"
  }
}

HTTP/1.1 201 Created
Location: https://sandbox.kopokopo.com/api/v1/settlement_transfers/d76265cd-0951-e511-80da-0aa34a9b2388
transfer_params = {
    destination_reference: '38f7c997-527c-452f-adc4-49ffab98982e',
    destination_type: 'merchant_bank_account',
    currency: 'currency',
    value: 'value',
    callback_url: 'callback_url',
}

# Using K2Connect - https://github.com/kopokopo/k2-connect-ruby (Recommended)
k2_transfer = K2Transfer.new(your_access_token)
# transfer request
transfer.transfer_funds(transfer_params)
k2_transfer.location_url # => "https://sandbox.kopokopo.com/api/v1/settlement_transfers/d76265cd-0951-e511-80da-0aa34a9b2388"
var transferOpts = {
  amount : 2250.00,
  currency: 'KES',
  destinationType: 'merchant_bank_account',
  destinationReference: '38f7c997-527c-452f-adc4-49ffab98982e',
  accessToken: 'myRand0mAcc3ssT0k3n',
  callbackUrl: 'https://your-call-bak.yourapplication.com/transfer_result'
}

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

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

 request_body = {
   "access_token": TransferTestCase.ACCESS_TOKEN,
   "destination_type": 'merchant_bank_account',
   "destination_reference": '6ad03242-2c6e-4050-8e46-987cb74f5326',
   "callback_url": 'https://webhook.site/52fd1913-778e-4ee1-bdc4-74517abb758d',
   "value": '10',
 }

# settle funds (targeted transfer)
transfer_transaction_location = transfer_service.settle_funds(request_body)
transfer_transaction_location # => 'https://sandbox.kopokopo.com/api/v1/settlement_transfers/d76265cd-0951-e511-80da-0aa34a9b2388'
<?
//  Using Kopo Kopo Connect - https://github.com/kopokopo/k2-connect-php (Recommended)
$transfer = $k2->SettlementTransferService();

$requestBody = [
  'amount' => 2250.00,
  'currency' => 'KES',
  'callbackUrl' => 'https://your-call-bak.yourapplication.com/transfer_result',
  'destinationType' => 'merchant_bank_account',
  'destinationReference' => '38f7c997-527c-452f-adc4-49ffab98982e',
  'accessToken' => 'myRand0mAcc3ssT0k3n'
];

$response = $transfer->settleFunds($options);
echo $response; // => 'https://sandbox.kopokopo.com/api/v1/settlement_transfers/d76265cd-0951-e511-80da-0aa34a9b2388'