定制 marqant-lab/marqant-pay-stripe 二次开发

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

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

marqant-lab/marqant-pay-stripe

Composer 安装命令:

composer require marqant-lab/marqant-pay-stripe

包简介

Stripe payment provider for marqant/marqant-pay package.

README 文档

README

This package makes the stripe payment provider available for the marqant/marqant-pay package.

Instalation

You can just require this package through composer as follows.

composer require marqant-lab/marqant-pay-stripe

Then you have to add the service infomration to the services.php configuration file of Laravel. To do so, update the configuration file as shown below.

return [
    // other services
    // ...

    'stripe' => [
        'key'    => env('STRIPE_KEY'),
        'secret' => env('STRIPE_SECRET'),
    ],
];

Next you have to add the environment variables. Go to your stripe dashboard and get your stripe key and secret, so you can add it to your .env file.

STRIPE_KEY=pk_test_iLokikJOvEuI2HlWgH4olf3P
STRIPE_SECRET=sk_test_BQokikJOvBiI2HlWgH4olfQ2

Now go ahead and enable the payment provider in the marqant-pay.php configuration file.

return [
    /*
     |--------------------------------------------------------------------------
     | Gateways
     |--------------------------------------------------------------------------
     |
     | In this section you can define all payment gateways that you need for
     | your project.
     |
     */

    'gateways' => [
        'stripe' => \Marqant\MarqantPayStripe\StripePaymentGateway::class,
    ],
];

Next you will need to add the fields for stripe on the billables you setup in the marqant-pay setup. So run the following for each billable model that you have setup (or will setup).

php artisan marqant-pay:migrations:stripe

If you are using the marqant-lab/marqant-pay-subscriptions package to enable subscriptions, then you will need to add the --subscriptions flag to the choosen command.

php artisan marqant-pay:migrations:stripe --subscriptions

Now you can run the migrations as usual.

php artisan migrate

And that's it, you should be good to go now.

###WebHooks:

We using spatie/laravel-stripe-webhooks package for stripe webhooks.

#####Configuration:

Add STRIPE_WEBHOOK_SECRET to your .env

You can find the secret used at the webhook configuration settings on the Stripe dashboard.

run $ php artisan migrate if you don't do it before.

Go to your your_project/app/Http/Middleware/VerifyCsrfToken.php and add this row:

    /**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        '/stripe/webhook'
    ];

Finally, take care of the routing:
At the Stripe dashboard you must configure at what url Stripe webhooks should hit your app.

You should set it up to '/stripe/webhook'.

Example of Endpoint URL:
http://your.awesome.site/stripe/webhook

Available stripe events:

  • payment_intent.succeeded
  • invoice.payment_succeeded
  • payment_intent.payment_failed
  • charge.failed (not completed)

For 'payment_intent.payment_failed' you should set configs 'marqant-pay.payment_urls.base_url' and 'marqant-pay.payment_urls.payment_sub_url',
description at config file.
You need also look at 'marqant-pay.support_emails' config.

You can also add to project/resources/lang these keys for translate:

  • "Here"
  • "Payment failed."
  • "Requires payment method."
  • "You needs to update your payment method in the"
    Don't forget: it should be json file.

Example resources/lang/en.json:

{
  "Payment failed.": "Payment failed translation."
}

They are used at emails for 'payment_intent.payment_failed' event

That's all you need

marqant-lab/marqant-pay-stripe 适用场景与选型建议

marqant-lab/marqant-pay-stripe 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 372 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 04 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 marqant-lab/marqant-pay-stripe 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 marqant-lab/marqant-pay-stripe 我们能提供哪些服务?
定制开发 / 二次开发

基于 marqant-lab/marqant-pay-stripe 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-27