pkboom / laravel-plaid-webhooks

dev-master 2019-05-19 18:15 UTC

This package is auto-updated.

Last update: 2024-09-20 06:37:01 UTC


README

在使用此包之前,我们强烈建议您阅读Plaid网站上有关webhook的完整文档

安装

您可以通过composer安装此包

composer require pkboom/laravel-plaid-webhooks

服务提供器将自动注册自己。

您必须使用以下命令发布配置文件

php artisan vendor:publish --tag="plaid-config"

这是将发布到 config/stripe-webhooks.php 的配置文件内容

return [

    /*
     * You can define the job that should be run when a certain webhook hits your application here.
     *
     * You can find a list of Plaid webhook types here:
     * https://plaid.com/docs/#auth-webhooks
     */
    'jobs' => [
        // 'AUTH' => \App\Jobs\PlaidWebhookCall\AUTH::class,
    ],

    /*
     * The classname of the model to be used. The class should equal or extend
     * Pkboom\PlaidWebhooks\PlaidWebhookCall.
     */
    'model' => Pkboom\PlaidWebhooks\PlaidWebhookCall::class,
];

接下来,您必须创建 plaid_webhook_calls

php artisan vendor:publish --tag="plaid-migration"
php artisan migrate

最后,注意路由:当您创建项目时,您必须设置Plaid webhook。在您的应用程序的路由文件中,您必须将此路由传递给 Route::plaidWebhooks

Route::plaidWebhooks('webhook-url');

在幕后,这将注册一个到由本包提供的控制器的 POST 路由。因为Plaid没有获取csrf-token的方法,您必须将该路由添加到 VerifyCsrfToken 中间件的 except 数组中

protected $except = [
    'webhook-url',
];

使用方法

有关使用方法,请参阅spatie/laravel-stripe-webhooks

测试

composer test

许可证

MIT许可证(MIT)。有关更多信息,请参阅MIT许可证