定制 coinwaka/laravel-coinwaka 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

coinwaka/laravel-coinwaka

Composer 安装命令:

composer require coinwaka/laravel-coinwaka

包简介

Laravel integration for the Coinwaka Pay API.

README 文档

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

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-23