coinwaka/laravel-coinwaka

Laravel integration for the Coinwaka Pay API.

Maintainers

Package info

github.com/coinwaka/laravel-coinwaka

pkg:composer/coinwaka/laravel-coinwaka

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-06-23 19:26 UTC

This package is auto-updated.

Last update: 2026-06-23 19:30:48 UTC


README

Laravel integration for the Coinwaka Pay API, on top of the coinwaka/coinwaka-php SDK. Auto-discovered service provider + facade, a publishable config, and a signed webhook receiver that dispatches a Laravel event.

composer require coinwaka/laravel-coinwaka
php artisan vendor:publish --tag=coinwaka-config
COINWAKA_SECRET_KEY=cwk_test_sk_...
COINWAKA_WEBHOOK_SECRET=whsec_...

Create a payment

use Coinwaka\Laravel\Facades\Coinwaka;

$intent = Coinwaka::paymentIntents()->create([
    'amount' => (string) $order->total,
    'currency' => 'KES',
    'settlement_currency' => 'USDT',
    'payment_methods' => ['mpesa', 'card', 'coinwaka_balance'],
    'merchant_reference' => (string) $order->id,
]);

return redirect()->away($intent['checkout_url']);

Or inject the client: public function store(\Coinwaka\Coinwaka $coinwaka).

Handle webhooks

The package registers POST /coinwaka/webhook (configurable), verifies the signature, and dispatches an event. Add the URL in your Coinwaka console and put its signing secret in COINWAKA_WEBHOOK_SECRET. Then listen:

use Coinwaka\Laravel\Events\CoinwakaWebhookReceived;

Event::listen(function (CoinwakaWebhookReceived $event) {
    if ($event->type() === 'payment_intent.paid') {
        $orderId = $event->data()['merchant_reference'] ?? null;
        // fulfil the order; dedupe on $event->id()
    }
});

License

MIT