1. Go to this page and download the library: Download danipa/sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danipa / sdk example snippets
use Danipa\Sdk\Danipa;
use Danipa\Sdk\RequestOptions;
use Danipa\Sdk\Model\CreateCollectionRequest;
use Danipa\Sdk\Model\Payer;
// API key prefix decides sandbox vs production:
// dk_test_… → https://api.sandbox.danipa.com/ms
// dk_live_… → https://api.danipa.com/ms
$danipa = Danipa::builder()
->apiKey(getenv('DANIPA_API_KEY'))
->build();
$collection = $danipa->collections()->create(
new CreateCollectionRequest(
amount: '125.00',
currency: 'GHS',
payer: Payer::phone('+233244112233', 'Ama K.'),
),
RequestOptions::withIdempotencyKey('order-1234'),
);
echo $collection->status->value; // "PENDING"
use Danipa\Sdk\Model\CreateDisbursementRequest;
use Danipa\Sdk\Model\Recipient;
$danipa->disbursements()->create(
new CreateDisbursementRequest(
amount: '500.00',
currency: 'GHS',
recipient: Recipient::phone('+233244998877', 'Kojo'),
),
RequestOptions::withIdempotencyKey('payout-' . $order->id),
);