hakito/cakephp-stripe-payment-intents-plugin
Composer 安装命令:
composer require hakito/cakephp-stripe-payment-intents-plugin
包简介
CakePHP Plugin for Stripe Payment Intents
README 文档
README
CakePHP-StripePaymentIntents-Plugin
CakePHP 4.x plugin for Stripe Payment Intents
Installation
Using composer
If you are using composer simply add it using the following command:
composer require hakito/cakephp-stripe-payment-intents-plugin
Without composer
Download the plugin to app/Plugin/StripePaymentIntents.
Load the plugin
Load the Plugin in your Application.php
public function bootstrap(): void { // Call parent to load bootstrap from files. parent::bootstrap(); $this->addPlugin(\StripePaymentIntents\Plugin::class, ['routes' => true]); }
Confguration
Add the following config to your app.php
'StripePaymentIntents' => [ 'mode'=> 'test', 'currency' => 'eur', 'keys' => [ 'test' => [ 'secret' => 'sk_test_4eC39HqLyjWDarjtT1zdp7dc', 'public' => 'pk_test_abc', ], 'live' => [ 'secret' => 'sk_live_key', 'public' => 'pk_live_key' ] ], 'logging' => false, ]
You can also setup logging
'Log' => [ 'stripe' => [ 'className' => FileLog::class, 'path' => LOGS, 'file' => 'stripe', 'scopes' => ['Stripe'], 'levels' => ['warning', 'error', 'critical', 'alert', 'emergency', 'info'], ], ]
Usage
In your payment handling controller:
// Load the component public function initialize(): void { parent::initialize(); $this->loadComponent('StripePaymentIntents.StripePaymentIntents'); }
Create or retrieve a payment intent for the checkout process
// create new $pi = $this->StripePaymentIntents->Create(1234, ['metadata' => ['order_id' => $orderId]]); // 12.34 // or update shopping cart $pi = $this->StripePaymentIntents->Retrieve('pi_xyz');
Set the view data
$this->set('StripeClientSecret', $pi->client_secret); $this->set('StripePublicKey', $this->StripePaymentIntents->GetPublicKey());
Implement the view behavior according to stripe documentation.
Stripe webhook events
You have to handle stripe events implementing an event handler:
\Cake\Event\EventManager::instance()->on('StripePaymentIntents.Event', function (\Cake\Event\Event $event, \Stripe\Event $stripeEvent) { return ['handled' => true]; // If you don't set the handled flag to true // the plugin will throw an exception });
hakito/cakephp-stripe-payment-intents-plugin 适用场景与选型建议
hakito/cakephp-stripe-payment-intents-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 192 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 11 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「payments」 「stripe」 「credit card」 「payments intents」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hakito/cakephp-stripe-payment-intents-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hakito/cakephp-stripe-payment-intents-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hakito/cakephp-stripe-payment-intents-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This Extension integrates a credit check and more made by the LEONEX Risk Management Platform into your order process. Extensive configuration and evaluation options is provided in the Platform
Integration with Cielo gateway.
Flexible payment integration for Laravel, lunarphp, supporting multiple payment providers.
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
统计信息
- 总下载量: 192
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2019-11-11