PHPackages                             dominservice/laravel-stripe - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. dominservice/laravel-stripe

ActiveLibrary[Payment Processing](/categories/payments)

dominservice/laravel-stripe
===========================

Laravel integration for Stripe.

1.6.0(1mo ago)026MITPHPPHP ^8.1|^8.2|^8.3

Since Feb 19Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/dominservice/laravel-stripe)[ Packagist](https://packagist.org/packages/dominservice/laravel-stripe)[ Docs](https://github.com/dominservice/laravel-stripe)[ RSS](/packages/dominservice-laravel-stripe/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (40)Versions (14)Used By (0)

Laravel Stripe
==============

[](#laravel-stripe)

[![Packagist](https://camo.githubusercontent.com/c064671e49c6b18926b2167cf706b7c7b6be6dcf4afe1b8dbef48aae55744022/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f6d696e736572766963652f6c61726176656c2d7374726970652e737667)](https://packagist.org/packages/dominservice/laravel-stripe)[![Latest Version](https://camo.githubusercontent.com/fb1521b6532836aa98c537810e0d96680ff24739bda48661bf9231d2e0cc3f96/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f646f6d696e736572766963652f6c61726176656c2d7374726970652e7376673f7374796c653d666c61742d737175617265)](https://github.com/dominservice/laravel-stripe/releases)[![Total Downloads](https://camo.githubusercontent.com/a695f26ace9bc28943c3b792dd8b9dc171dc2a6840cd50715858af6d6c992895/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f6d696e736572766963652f6c61726176656c2d7374726970652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dominservice/laravel-stripe)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Stripe integration package for Laravel projects that need a practical repository-based API for:

- Checkout Sessions
- Customers
- Products and Prices
- Refunds
- Stripe Connect onboarding
- webhook verification
- country-aware payment method selection

Laravel 10-13 on PHP 8.1+.

Features
--------

[](#features)

- repository-style Stripe API wrapper,
- Checkout Session creation with support for Stripe-hosted checkout parameters,
- customer, product, price and invoice helpers,
- Stripe Connect support for Express onboarding flows,
- webhook signature verification middleware,
- currency normalization and minimum amount validation,
- payment method selection helper based on customer country and presentment currency,
- optional policy filters for customer type, MCC / branch, project type and explicit allow / deny lists.

Compatibility
-------------

[](#compatibility)

Current compatibility targets:

- Laravel 10 on PHP 8.1+
- Laravel 11 on PHP 8.2+
- Laravel 12 on PHP 8.2+
- Laravel 13 on PHP 8.3+

Installation
------------

[](#installation)

```
composer require dominservice/laravel-stripe
```

Add your Stripe credentials in `.env`:

```
STRIPE_KEY=pk_live_xxx
STRIPE_SECRET=sk_live_xxx
STRIPE_WEBHOOK_CHECKOUT=whsec_xxx
```

Publish config:

```
php artisan vendor:publish --provider="Dominservice\\LaraStripe\\ServiceProvider" --tag=stripe
```

Publish migrations:

```
php artisan vendor:publish --provider="Dominservice\\LaraStripe\\ServiceProvider" --tag=stripe-migrations
```

Run migrations:

```
php artisan migrate
```

Configuration
-------------

[](#configuration)

Main configuration file:

- `config/stripe.php`

Important sections:

- `stripe.key`
- `stripe.secret`
- `stripe.webhooks.*`
- `stripe.currencies`
- `stripe.minimum_charge_amounts`
- `stripe.zero_decimal_currencies`
- `stripe.three_decimal_currencies`
- `stripe.payment_method_policies`

### Allowed currencies

[](#allowed-currencies)

If your application only supports specific currencies, list them in:

```
'currencies' => ['PLN', 'EUR', 'USD', 'GBP'],
```

If a currency is not declared there, helper validation will reject it.

### User model mapping

[](#user-model-mapping)

Check whether the package config matches your project:

- `stripe.model`
- `stripe.email_key`
- `stripe.name_key`

Webhooks
--------

[](#webhooks)

Attach the middleware `stripe.verify:{name}` to routes that receive Stripe webhook calls.

Example:

```
Route::middleware(['stripe.verify:checkout'])->group(function () {
    Route::post('/webhook/payments', [WebhookController::class, 'payments']);
});
```

`{name}` maps to:

```
config('stripe.webhooks.signing_secrets.checkout')
```

Basic Usage
-----------

[](#basic-usage)

```
use Dominservice\LaraStripe\Client as StripeClient;

$stripe = new StripeClient();
```

### Create a customer

[](#create-a-customer)

```
$customer = $stripe->customers()
    ->setName($user->name)
    ->setEmail($user->email)
    ->setPhone($user->phone)
    ->setAddress([
        'country' => 'PL',
        'city' => 'Warszawa',
        'postal_code' => '00-000',
        'line1' => 'ul. Kopernika 1/2',
    ])
    ->create($user);
```

### Create a product with price

[](#create-a-product-with-price)

```
$productStripe = $stripe->products()
    ->setName($product->name)
    ->setActive(true)
    ->setExtendPricesCurrency('pln')
    ->setExtendPricesUnitAmount((float) $amount)
    ->setExtendPricesBillingScheme('per_unit')
    ->create($product);
```

### Create a Checkout Session

[](#create-a-checkout-session)

```
$session = $stripe->checkoutSessions()
    ->setSuccessUrl(route('payment.afterTransaction', $order->ulid) . '?session_id={CHECKOUT_SESSION_ID}')
    ->setCancelUrl(route('payment.canceled', $order->ulid))
    ->setMode('payment')
    ->setClientReferenceId($order->ulid)
    ->setCustomer($customer->id)
    ->setLineItems([
        [
            'price' => $productStripe->default_price->id,
            'quantity' => 1,
        ],
    ])
    ->create();
```

Stripe Checkout Support
-----------------------

[](#stripe-checkout-support)

The package allows passing Stripe Checkout parameters such as:

- `allow_promotion_codes`
- `automatic_tax`
- `billing_address_collection`
- `cancel_url`
- `consent_collection`
- `customer_creation`
- `customer_update`
- `invoice_creation`
- `locale`
- `payment_method_collection`
- `payment_method_configuration`
- `payment_method_options`
- `payment_method_types`
- `phone_number_collection`
- `shipping_address_collection`
- `success_url`
- `tax_id_collection`
- `ui_mode`

These are handled in the Checkout Session repository and forwarded to Stripe if valid.

Currency Helpers
----------------

[](#currency-helpers)

### Normalize currency code

[](#normalize-currency-code)

```
use Dominservice\LaraStripe\Helpers\PaymentHelper;

$currency = PaymentHelper::normalizeCurrencyCode('eur', true); // eur
```

### Validate and normalize amount

[](#validate-and-normalize-amount)

```
$unitAmount = PaymentHelper::getValidAmount('EUR', 49.99); // 4999
```

The helper:

- validates configured currencies,
- handles zero-decimal and three-decimal currencies,
- validates Stripe minimum charge amounts.

Payment Methods by Country
--------------------------

[](#payment-methods-by-country)

The package contains a helper that can build manual `payment_method_types` for Stripe Checkout.

```
use Dominservice\LaraStripe\Helpers\PaymentHelper;

$methods = PaymentHelper::getPaymentMethodsByCountry('PL', 'PLN');
// ['card', 'blik', 'klarna', 'p24', 'paypal']
```

Another example:

```
$methods = PaymentHelper::getPaymentMethodsByCountry('DE', 'EUR');
// ['card', 'klarna', 'paypal', 'sepa_debit']
```

### What the helper currently does

[](#what-the-helper-currently-does)

It:

- always keeps `card`,
- adds methods supported for the customer country,
- applies presentment currency restrictions,
- excludes deprecated methods such as `giropay` and `sofort`,
- optionally filters by project policies.

### Current optional third argument

[](#current-optional-third-argument)

```
$methods = PaymentHelper::getPaymentMethodsByCountry('PL', 'PLN', [
    'customer_type' => 'private',
    'mcc' => '7991',
    'project_type' => 'travel',
    'allowed_methods' => ['card', 'blik', 'paypal'],
    'forbidden_methods' => ['klarna'],
]);
```

Supported context keys:

- `customer_type`
- `mcc`
- `project_type`
- `business_type`
- `allowed_methods`
- `forbidden_methods`

This third argument is optional. If you do not pass it, older integrations keep working as before.

Payment Method Policies
-----------------------

[](#payment-method-policies)

The policy layer is configured in:

```
stripe.payment_method_policies
```

It is optional by design. If you leave it empty, the helper falls back to country + currency only.

### 1. Allowed methods for project / business type

[](#1-allowed-methods-for-project--business-type)

```
'allowed_methods_by_project_type' => [
    'travel' => ['card', 'paypal'],
    'hotel' => ['card', 'paypal', 'klarna'],
    'saas' => ['card', 'paypal', 'sepa_debit'],
],
```

If your project prefers `business_type` naming, the package also supports:

```
'allowed_methods_by_business_type' => [
    'tourism' => ['card', 'paypal'],
    'saas' => ['card', 'paypal', 'sepa_debit'],
],
```

### 2. Forbidden methods for project / business type

[](#2-forbidden-methods-for-project--business-type)

```
'forbidden_methods_by_project_type' => [
    'travel' => ['p24'],
],
```

The same alias exists for:

```
'forbidden_methods_by_business_type' => [
    'regulated' => ['klarna'],
],
```

### 3. Forbidden methods for customer type

[](#3-forbidden-methods-for-customer-type)

By default the package excludes `klarna` for:

```
'customer_type' => 'company'
```

because Klarna does not support B2B flows in the same way as private consumer checkout.

### 4. Forbidden MCC by payment method

[](#4-forbidden-mcc-by-payment-method)

The package now ships with a default MCC restriction map for `p24`, based on the current Stripe documentation.

This matters especially for projects in categories such as:

- travel agencies,
- tour operators,
- hotels,
- transport,
- software,
- healthcare,
- advertising,
- real estate,
- gambling,
- higher education.

The restriction list is configurable, so the host project can override or extend it.

### 5. Forbidden methods by MCC / branch

[](#5-forbidden-methods-by-mcc--branch)

If the host project prefers a category-first policy view instead of the method-first `forbidden_mcc_by_method`, it can also define:

```
'forbidden_methods_by_mcc' => [
    '4722' => ['p24'],
    '7011-7012' => ['p24'],
],
```

Both policy styles can coexist. The helper merges them.

### Backward compatibility

[](#backward-compatibility)

All policy layers are optional:

- if you do not configure project type policies, nothing changes,
- if you do not configure business type policies, nothing changes,
- if you do not pass `customer_type`, no customer-type filtering happens,
- if you do not pass `mcc`, MCC rules are not evaluated,
- if you do not pass allow / deny lists, they are ignored.

This keeps older integrations working without forced refactors.

Stripe Connect
--------------

[](#stripe-connect)

The package supports the base repositories required for Stripe Connect onboarding:

- `accounts()`
- `accountLinks()`
- `loginLinks()`

Typical platform flow:

```
use Dominservice\LaraStripe\Client as StripeClient;

$stripe = new StripeClient();

$account = $stripe->accounts()
    ->setType('express')
    ->setCountry('PL')
    ->setEmail($expert->email)
    ->setCapabilities([
        'transfers' => ['requested' => true],
    ])
    ->create($expert);

$onboarding = $stripe->accountLinks()
    ->setAccount($account->id)
    ->setRefreshUrl(route('expert.billing.refresh'))
    ->setReturnUrl(route('expert.billing.return'))
    ->setType('account_onboarding')
    ->create();

$loginLink = $stripe->loginLinks()->create($account->id);
```

For marketplace split payments handled on the platform account, create Checkout Sessions with:

- `payment_intent_data.application_fee_amount`
- `payment_intent_data.transfer_data.destination`

Notes for DominPress-family Projects
------------------------------------

[](#notes-for-dominpress-family-projects)

This package is already useful for:

- public booking flows such as 44Islands,
- marketplace and panel billing flows,
- future SaaS-style projects in the DominPress family,
- DPS-related projects that need:
    - Checkout Sessions,
    - Connect onboarding,
    - invoice-compatible payment metadata,
    - project-specific payment method policies.

For projects with strongly regulated payment availability, the host application should pass:

- customer country,
- presentment currency,
- customer type,
- MCC,
- project type or business type.

That gives the helper enough context to avoid showing methods that should not be available.

Recommended Host-Project Strategy
---------------------------------

[](#recommended-host-project-strategy)

For Checkout-based implementations:

1. collect billing country in the public form,
2. determine presentment currency before session creation,
3. pass `customer_type` if the checkout distinguishes private vs company,
4. pass `mcc` or `project_type` if the business has method restrictions,
5. build `payment_method_types` through `PaymentHelper::getPaymentMethodsByCountry(...)`.

This is especially relevant when a single codebase serves:

- public tourism booking,
- B2B SaaS checkout,
- expert / partner payouts through Connect.

Support
-------

[](#support)

### Support this project (Ko-fi)

[](#support-this-project-ko-fi)

If this package saves you time, consider buying me a coffee:

Thank you.

License
-------

[](#license)

MIT

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance93

Actively maintained with recent releases

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity65

Established project with proven stability

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Recently: every ~47 days

Total

13

Last Release

37d ago

PHP version history (3 changes)1.0.0PHP ^8.1

1.3.0PHP ^8.1|^8,2|^8.3

1.5.1PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d67c041316385020aafb7eef9f11971d6fad80a11a44f4078273bda6890722d?d=identicon)[dominservice](/maintainers/dominservice)

---

Tags

laravelstripe

### Embed Badge

![Health badge](/badges/dominservice-laravel-stripe/health.svg)

```
[![Health](https://phpackages.com/badges/dominservice-laravel-stripe/health.svg)](https://phpackages.com/packages/dominservice-laravel-stripe)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k31.8M162](/packages/laravel-cashier)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M230](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k16.3M154](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9922.4M146](/packages/roots-acorn)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
