vulcandigital/silverstripe-paypalwebhook
Composer 安装命令:
composer require vulcandigital/silverstripe-paypalwebhook
包简介
A delegation interface for handling PayPal webhook events
README 文档
README
This module is a PayPal webhook event handling delegation interface, a subclass can handle one or more event and an event can be handled by one or more subclass
Requirements
- silverstripe/framework: ^4
Configuration
By default the environment is set to sandbox
Vulcan\PayPalWebhook\PayPalWebhook: environment: sandbox oauth_sandbox_clientid: ".." oauth_sandbox_secretid: ".." oauth_live_clientid: ".." oauth_live_secretid: ".." webhook_sandbox_id: ".." webhook_live_id: ".."
You can also use test keys and the webhook simulator will work fine with this module
WARNING: While this module is in sandbox mode, events will NOT be verified!
Usage
- Install and dev/build
- Add a sandbox webhook endpoint to PayPal that points to https://yourdomain.com/paypal-webhook and ensure that it sends the events you require
- Create your functionality for your event(s):
<?php use Vulcan\PayPalWebhook\Handlers\PayPalEventHandler; class CustomerDisputeHandler extends PayPalEventHandler { private static $events = [ 'CUSTOMER.DISPUTE.CREATED' ]; public static function handle($event, array $data) { // $event is the string identifier of the event return "Do something here"; } }
Any subclass of PayPalEventHandler is detected and requires both the private static $events
and public static function handle($event, $data) to be defined.
private static $events must be defined and can be a string containing a single event identifier or an array with multiple
public static function handle($event,$data) must be defined and should not call the parent. $data will be a \Stripe\Event object which has the exact same hierarchy as the JSON response depicted in their examples.
Features
- All handled events are logged, along with the responses from their handlers.
- Duplicates are ignored, if PayPal sends the same event more than once it won't be processed, but the logged event will count the occurence
- All events are verified to have been sent from PayPal using the webhook ID you defined in the configuration above
Why?
Easily introduce new event handling functionality without needing to touch any files relating to other event handling classes.
License
vulcandigital/silverstripe-paypalwebhook 适用场景与选型建议
vulcandigital/silverstripe-paypalwebhook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 03 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vulcandigital/silverstripe-paypalwebhook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vulcandigital/silverstripe-paypalwebhook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-03-01