PHPackages                             yared/laravel-smart-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. yared/laravel-smart-stripe

ActiveLibrary[Payment Processing](/categories/payments)

yared/laravel-smart-stripe
==========================

Secure Stripe Payments for Laravel with Fraud Detection, Automatic Webhooks, Smart Checkout, and Payment Logging

00PHP

Since Mar 12Pushed 2mo agoCompare

[ Source](https://github.com/yared-ayele-debela/laravel-smart-stripe)[ Packagist](https://packagist.org/packages/yared/laravel-smart-stripe)[ RSS](/packages/yared-laravel-smart-stripe/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Smart Stripe
====================

[](#laravel-smart-stripe)

**One-time Stripe payments for Laravel — flexible for hotel bookings, ecommerce, donations, and more.**

[![Latest Version](https://camo.githubusercontent.com/14f47b541b08fcd8bdbe88e97d83fb3536b355bd304497428ab1c591b80870bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79617265642f6c61726176656c2d736d6172742d7374726970652e737667)](https://packagist.org/packages/yared/laravel-smart-stripe)[![License](https://camo.githubusercontent.com/56a9a77c5c2818bf154ee71f98f7e343dd05d968d67370c50486d7b3fb9adbe6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f79617265642f6c61726176656c2d736d6172742d7374726970652e737667)](https://packagist.org/packages/yared/laravel-smart-stripe)

One-line payments:

```
StripePay::charge(1000)->from($user)->pay();
```

or redirect to Stripe Checkout:

```
return StripePay::checkout()
    ->product('Hotel Room')
    ->price(1999)
    ->success('/success')
    ->cancel('/cancel')
    ->redirect();
```

Features
--------

[](#features)

- **One-time payments only** — No subscriptions; ideal for bookings, orders, donations
- **One-line charge** — Fluent API for direct charges
- **Smart Checkout** — Single item or multi-item cart (ecommerce)
- **Webhooks** — `payment_succeeded`, `payment_failed`, `refund_created`
- **Fraud detection** — IP limits, rapid attempts, suspicious countries
- **Smart metadata** — Auto-attach user\_id, IP, browser, country, app name
- **Payable handlers** — Auto-update models (e.g. Booking, Order) when paid
- **Payment logging** — Audit trail for every Stripe interaction
- **Queue support** — Background processing
- **Test simulator** — Simulate success/failure/refund locally

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

[](#installation)

```
composer require yared/laravel-smart-stripe
```

Publish config and migrations:

```
php artisan vendor:publish --tag=stripe-smart-config
php artisan vendor:publish --tag=stripe-smart-migrations
php artisan migrate
```

Add to `.env`:

```
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
STRIPE_CURRENCY=usd
```

Usage
-----

[](#usage)

### Direct charge

[](#direct-charge)

```
use Yared\SmartStripe\Facades\StripePay;

StripePay::charge(2000)
    ->currency('usd')
    ->customer($user)
    ->description('Order #2001')
    ->metadata(['order_id' => 2001])
    ->pay();
```

### With fraud detection

[](#with-fraud-detection)

```
StripePay::charge(1000)
    ->from($user)
    ->detectFraud()
    ->pay();
```

### Stripe Checkout (single item)

[](#stripe-checkout-single-item)

```
return StripePay::checkout()
    ->product('Premium Plan')
    ->price(1999)
    ->success('/success')
    ->cancel('/cancel')
    ->redirect();
```

### Multi-item checkout (ecommerce cart)

[](#multi-item-checkout-ecommerce-cart)

```
return StripePay::checkout()
    ->items([
        ['name' => 'Room A', 'price' => 15000, 'quantity' => 2, 'description' => '2 nights'],
        ['name' => 'Breakfast', 'price' => 999, 'quantity' => 1],
    ])
    ->metadata(['booking_id' => $booking->id])
    ->success('/hotel/success')
    ->cancel('/hotel/cancel')
    ->redirect();
```

### Hotel booking example

[](#hotel-booking-example)

```
StripePay::checkout()
    ->product("Room {$room->name} - {$checkIn} to {$checkOut}")
    ->price($totalCents)
    ->metadata(['booking_id' => $booking->id])
    ->success(route('hotel.success'))
    ->cancel(route('hotel.cancel'))
    ->redirect();
```

### Refund

[](#refund)

```
StripePay::refund($paymentIntentId);
StripePay::refund($paymentIntentId, 500); // Partial refund
```

### Queue payment

[](#queue-payment)

```
StripePay::charge(2000)
    ->customer($user)
    ->queue();
```

### Auto-update payment status (Payable handlers)

[](#auto-update-payment-status-payable-handlers)

In `config/stripe-smart.php`:

```
'payable_handlers' => [
    'booking_id' => [
        'model' => \App\Models\Booking::class,
        'method' => 'markAsPaid',
    ],
    'order_id' => [
        'model' => \App\Models\Order::class,
        'method' => 'markAsPaid',
    ],
],
```

Include the metadata key when creating checkout:

```
StripePay::checkout()
    ->product('Hotel Booking')
    ->price(1999)
    ->metadata(['booking_id' => $booking->id])
    ->success('/success')
    ->redirect();
```

### Success page helper

[](#success-page-helper)

```
$session = StripePay::retrieveCheckoutSession($request->query('session_id'));
$metadata = StripePayment::getSessionMetadata($session);
$bookingId = $metadata['booking_id'] ?? null;
```

### Webhook listeners

[](#webhook-listeners)

In `AppServiceProvider::boot()`:

```
use Yared\SmartStripe\Facades\StripeWebhook;

StripeWebhook::listen('payment_succeeded', function ($event) {
    $orderId = $event->data->object->metadata['order_id'] ?? null;
    if ($orderId) {
        Order::find($orderId)?->markPaid();
    }
});

StripeWebhook::listen('payment_failed', fn ($event) => /* ... */);
StripeWebhook::listen('refund_created', fn ($event) => /* ... */);
```

Supported events: `payment_succeeded`, `payment_failed`, `refund_created`.

### Test simulator

[](#test-simulator)

```
STRIPE_SIMULATOR_ENABLED=true
```

```
StripePay::simulateSuccess();
StripePay::simulateFailure(); // Throws exception
StripePay::simulateRefund();
```

### Billable user trait

[](#billable-user-trait)

Add to your User model:

```
use Yared\SmartStripe\Traits\BillableUser;

class User extends Authenticatable
{
    use BillableUser;
}
```

Add `stripe_id` to users (migration included):

```
$user->createAsStripeCustomer();
$user->asStripeCustomer();
```

Security
--------

[](#security)

- Webhook signature verification
- CSRF excluded for webhook route only
- Fraud detection (configurable)
- Rate limiting on webhook endpoint
- Payment logging for audit trail

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

[](#configuration)

See `config/stripe-smart.php`:

- `fraud_detection` — Limits per IP/user, suspicious countries
- `metadata` — Auto-attach user\_id, IP, browser, etc.
- `logging` — Payment audit logs
- `simulator` — Test mode for local development

License
-------

[](#license)

MIT

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance58

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5727fb2630a34a7641505a6a706230943683ed204aa0fa244343ae5622f61872?d=identicon)[yared-ayele-debela](/maintainers/yared-ayele-debela)

---

Top Contributors

[![yared-ayele-debela](https://avatars.githubusercontent.com/u/112660399?v=4)](https://github.com/yared-ayele-debela "yared-ayele-debela (3 commits)")

### Embed Badge

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

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

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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