Official Shika Creators PHP SDK for accepting Mobile Money payments in Ghana
# Shika Creators PHP SDK
Official PHP SDK for the Shika Creators payment gateway. Accept Mobile Money payments in Ghana.
## Requirements
- PHP 7.4 or higher
- cURL extension
- JSON extension
## Installation
```bash
composer require ebenezersakyi/shika-php
```
## Quick Start
```php
payments->create([
'amount' => 100.00, // GHS
'payment_method' => [
'type' => 'mobile_money',
'phone_number' => '0241234567',
],
'description' => 'Order #1234',
]);
echo $payment['id']; // pay_xxx
echo $payment['status']; // 'pending'
```
## Usage
### Initialize the Client
```php
use Shika\Shika;
// Live mode
$shika = new Shika('sk_live_xxx');
// Test mode
$testShika = new Shika('sk_test_xxx');
// With custom configuration
$shika = new Shika('sk_live_xxx', [
'base_url' => '
api.13.220.123.118.nip.io',
'timeout' => 30,
]);
```
### Payments
#### Create a Payment
```php
$payment = $shika->payments->create([
'amount' => 50.00,
'currency' => 'GHS', // optional, defaults to GHS
'payment_method' => [
'type' => 'mobile_money',
'phone_number' => '0241234567',
'provider' => 'mtn', // optional, auto-detected from number
],
'description' => 'Order payment',
'metadata' => [
'order_id' => '12345',
],
]);
```
#### Retrieve a Payment
```php
$payment = $shika->payments->retrieve('pay_xxx');
```
#### List Payments
```php
$payments = $shika->payments->all([
'limit' => 10,
'status' => 'completed',
]);
foreach ($payments['data'] as $payment) {
echo $payment['id'] . ' - ' . $payment['amount'] . PHP_EOL;
}
// Pagination
if ($payments['has_more']) {
$lastId = end($payments['data'])['id'];
$nextPage = $shika->payments->all([
'starting_after' => $lastId,
]);
}
```
### Payouts
#### Create a Payout
```php
$payout = $shika->payouts->create([
'amount' => 100.00,
'destination' => [
'type' => 'mobile_money',
'phone_number' => '0241234567',
'account_name' => 'John Doe',
],
'description' => 'Withdrawal',
]);
```
#### Retrieve a Payout
```php
$payout = $shika->payouts->retrieve('po_xxx'); …