Latest Version on Packagist GitHub Actions

Total Downloads

This package provides a Stripe payment adapter for Lunar API. It can authorize your payments and handle incoming Stripe webhooks.

Getting started

Should be as easy as:

  1. Install the package
  2. Fill in your env variables
  3. Accept payments


You can install the package via composer:

composer require dystcz/lunar-api-stripe-adapter

You can publish the config file with:

php artisan vendor:publish --provider="Dystcz\LunarApiStripeAdapter\LunarApiStripeAdapterServiceProvider" --tag="lunar-api.stripe"

This will publish two configuration files:

  1. config/lunar-api/stripe.php - contains the payment adapter configuration
  2. config/stripe-webhook.php - contains the webhook 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 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

Event Webhook handler class Description
payment_intent.succeeded HandlePaymentIntentSucceeded Dispatches OrderPaymentCanceled event.
payment_intent.payment_failed HandlePaymentIntentFailed Dispatches OrderPaymentFailed event.
payment_intent.canceled HandlePaymentIntentCanceled Authorizes the payment via AuthorizeStripePayment class which dispatches the OrderPaymentSuccessful.

You can listen to these and others events in your application and handle them accordingly.


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

// Get payment type

// Create a payment intent

// Handle a webhook (validate and authorize payment)


composer test


Please see CHANGELOG for more information on what has changed recently.


Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.



The MIT License (MIT). Please see License File for more information.