dystcz / lunar-api-stripe-adapter
Dystore Stripe payment adapter
Requires
- php: ^8.2
- dystcz/dystore-api: ^1.0
- illuminate/support: ^11.0
- lunarphp/stripe: ^1.0.0
- spatie/laravel-stripe-webhooks: ^3.6
- 1.x-dev
- 1.0.x-dev
- 1.0.0
- 1.0.0-beta.1
- 1.0.0-alpha.37
- 1.0.0-alpha.1
- 0.8.x-dev
- 0.8.5
- 0.8.4
- 0.8.3
- 0.8.2
- 0.8.1
- 0.8.0
- 0.7.x-dev
- 0.7.1
- 0.7.0
- 0.6.x-dev
- 0.5.x-dev
- dev-main
- dev-fix/fix-finding-order
- dev-dev
- dev-feature/update-to-lunar-1.0.0-beta
- dev-feature/upgrade-to-lunar-api-1.0.0-alpha.37
- dev-feature/upgrade-to-lunar-api-1.0.0-alpha
- dev-feature/fix-automatic-payment-methods
- dev-feature/update-tests
- dev-feature/docs-init
- dev-feature/fix-payment-intent-failed-webhook
- dev-feature/find-order-redundancy
- dev-feature/lunar-api-0.8.1
- dev-feature/stripe-webhooks
- dev-feature/handle-on-queue
This package is auto-updated.
Last update: 2024-12-10 12:49:40 UTC
README
This package provides a Stripe payment adapter for Dystore API. It can authorize your payments and handle incoming Stripe webhooks.
Getting started
Should be as easy as:
- Install the package
- Fill in your env variables
- Accept payments
Installation
You can install the package via composer:
composer require dystcz/dystore-stripe
You can publish the config file with:
php artisan vendor:publish --provider="Dystore\Stripe\StripeServiceProvider" --tag="dystore.stripe"
This will publish two configuration files:
config/dystore/stripe.php
- contains the payment adapter configurationconfig/stripe-webhook.php
- contains the webhook configuration
Configuration
Setting up the webhooks
You can configure the Stripe webhooks in the config/stripe-webhook.php
file.
This package builds on top of Spatie's laravel-stripe-webhooks
package, so you can use the same configuration.
For more configuration options, please refer to the documentation
of the package.
Setting up environment variables
Do not forget to fill in your .env
file with the following variables:
STRIPE_PUBLIC_KEY=pk_live_... STRIPE_SECRET_KEY=sk_live_... STRIPE_WEBHOOK_SECRET=whsec_... STRIPE_WEBHOOK_CONNECTION=redis STRIPE_WEBHOOK_QUEUE=priority STRIPE_SIGNATURE_VERIFY=true
Stripe events and their webhook handlers
Here is a list of Stripe events which are currently handled by this package.
You can easily add your own handlers and register
them in the config/stripe-webhook.php
file.
You can add a couple of useful methods to your handlers
by extending the WebhookHandler
class.
Currently handled events
You can listen to these and others events in your application and handle them accordingly.
Note
All other events are handled by HandleOtherEvent
class
which does nothing by default, but you can easily swap the default
handler for your own in the config.
Advanced usage
If you ever need to implement custom logic, you can use the methods listed below.
$payment = App::make(StripePaymentAdapter::class); // Get payment driver $payment->getDriver(); // Get payment type $payment->getType(); // Create a payment intent $payment->createIntent($cart) // Handle a webhook (validate and authorize payment) $payment->handleWebhook($request)
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.