PHPackages                             bajjour/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. bajjour/stripe

ActiveLibrary[Payment Processing](/categories/payments)

bajjour/stripe
==============

A Laravel package for Stripe payment gateway

2.1.1(4mo ago)1249↓100%MITPHPPHP ^8.0

Since May 11Pushed 4mo ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (5)Used By (0)

Stripe Checkout Sessions Gateway for Laravel
============================================

[](#stripe-checkout-sessions-gateway-for-laravel)

This package provides a simple and easy-to-use interface to interact with **Stripe** in Laravel applications. It includes methods for creating checkout session and query checkout session status.

---

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

[](#installation)

You can install the package via Composer:

```
composer require bajjour/stripe
```

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

[](#configuration)

After installing the package, publish the configuration file:

```
php artisan vendor:publish --provider="Stripe\StripeServiceProvider" --tag="stripe-config"
```

Update your .env file with your Stripe API credentials:

```
STRIPE_API_KEY="your-secret-key"
STRIPE_3D_ENABLED=true #true or false
```

Usage
-----

[](#usage)

`Initialize the Service`

You can initialize the Stripe service in your controller:

```
use Stripe\Services\StripeService;

public function __construct(StripeService $stripe)
{
    $this->stripe = $stripe;
}
```

`Create a Checkout Session`

Create a new Checkout Session to generate payment link.

```
$response = $this->stripe->create_checkout_session([
            'currency' => 'paying-currency',
            'amount' => 'unit-amount-in-cents-to-be-charged',//for 1 dollar set to 100
            'product_name' => 'your product name',
            'success_url' => 'https://yourdomain.com/{success-route}',
            'ref_id' => 'your local reference id', //optional
            'quantity' => 'quantity', //optional, total price will be amount * quantity
            'product_description' => 'your-product-description', //optional
            'cancel_url' => 'https://yourdomain.com/{cancel-route}', //optional
        ]);
```

Response

detailed array from stripe returned, the main values we may use is

```
{
  "id":"checkout-session-id",
  "object": "checkout.session",
  "amount_total": "total-amount-to-pay",
  "currency": "pay-currency",
  "cancel_url": "cancel-url",
  "livemode": "false or true",
  "metadata": "sent reference id",
  "mode": "payment",
  "payment_method_options": {
    "card": {
      "request_three_d_secure": "challenge, any, or automatic"
    }
  },
  "payment_status": "unpaid",
  "status": "open",
  "success_url": "succcess-url",
  "ui_mode": "hosted",
  "url": "paying link"
}
```

`Get Checkout Session Status`

Retrieve details of a specific checkout session.

to ensure payment **status use status = complete &amp;&amp; payment\_status = paid**.

```
$this->stripe->get_checkout_session_status(session_id: 'your-checkout-session-id')
```

Response

same response of create checkout session returned but with updated status and payment status.

```
{
  "id":"checkout-session-id",
  "object": "checkout.session",
  "amount_total": "total-amount-to-pay",
  "currency": "pay-currency",
  "cancel_url": "cancel-url",
  "livemode": "false or true",
  "metadata": "sent reference id",
  "mode": "payment",
  "payment_method_options": {
    "card": {
      "request_three_d_secure": "challenge, any, or automatic"
    }
  },
  "payment_status": "paid",
  "status": "complete",
  "success_url": "succcess-url",
  "ui_mode": "hosted",
  "url": null
}
```

Subscription Functions
----------------------

[](#subscription-functions)

`Create subscription with specified interval`

```
$response = $this->stripe->create_subscription([
    'currency' => 'pay-currency',
    'amount' => 'total-amount-to-pay',
    'product_name' => 'your product name',
    'success_url' => 'https://yourdomain.com/{success-route}',
    'product_description' => 'your-product-description', //optional
    'interval' => 'month', //day, week, month, or year
    'interval_count' => '1', //each one month
]);
```

Response

detailed array from stripe returned, the main values we may use is

```
{
  "id":"checkout-session-id",
  "object": "checkout.session",
  "amount_subtotal": "sub-total-amount",
  "amount_total": "total-amount-to-pay",
  "currency": "pay-currency",
  "cancel_url": "cancel-url",
  "livemode": "false or true",
  "metadata": "sent reference id",
  "mode": "subscription",
  "payment_method_collection": "always",
  "payment_method_options": {
    "card": {
      "request_three_d_secure": "challenge, any, or automatic"
    }
  },
  "payment_status": "unpaid",
  "status": "open",
  "success_url": "succcess-url",
  "ui_mode": "hosted",
  "url": "paying link"
}
```

`Get Subscription Checkout Session`

you will use `get_checkout_session_status($session_id)` function to get status of checkout session and also get `$subscription_id` to followup subscription next payments

`Get Subscription Status`

you will use `get_subscription_status($subscription_id)` to get status of subscription, to get more info about how to handle subscriptions and created invoices in stripe you may go to stripe official documentation.

Checkout Session in Setup mode
------------------------------

[](#checkout-session-in-setup-mode)

to create checkout session with Setup Mode, you will use `create_setup_intent()` to generate link that allows saving customer payment info permanently in stripe and give you the ability to charge user when needed like the following scenario.

```
//generate stripe link that allows user to securely save their payment info.
$response = $this->stripe->create_setup_intent([
    'success_url' => 'https://example.com/success',
    'cancel_url' => 'https://example.com/cancel', //optional
]);
// we need "id", "setup_intent", "url" parameters from response to the next steps.

//to get customer info (customer_id, payment_method_id), and status of session.
$this->stripe->get_setup_intent_status($setup_intent_id);

//create invoice generating invoice in stripe that can be charged directly from your side, or sent to user to pay it.
$response = $this->stripe->create_invoice([
    'customer_id' => $customer_id,
    'amount' => 'total-amount',
    'currency' => 'pay-currency',
    'description' => 'your-product-description',
]);
// essentials returned parameters (id, hosted_invoice_url, invoice_pdf, status).

// to charge invoice automatically
$response = $this->stripe->charge_invoice($invoice_id, $payment_method_id);
// you can depend on "status" parameter to know if invoice has been paid.

// you can check invoice status using the following function:
$response = $this->stripe->get_invoice_status($invoice_id);
// essentials returned parameters (id, hosted_invoice_url, invoice_pdf, status).
```

Refund
------

[](#refund)

to handle stripe refunds functions you need to call the following functions.

```
//create refund
$response = $this->stripe->create_refund([
    'payment_intent' => 'pi_xxxxxxxxxx',
    'reason' => 'requested_by_customer', //optional one of the following (duplicate, fraudulent, requested_by_customer)
    'amount' => '10', //optional, send only if you need to make a partial refund
]);

//the following response is expected
{
    "id": "refund_id",
    "object": "refund",
    "amount": refund_amount,
    "currency": "usd",
    "destination_details": {
        "card": {
            "reference_status": "pending",
            "reference_type": "acquirer_reference_number",
            "type": "refund"
        },
        "type": "card"
    },
    "metadata": {},
    "payment_intent": "pi_xxxxxxxxxx",
    "reason": null,
    "receipt_number": null,
    "source_transfer_reversal": null,
    "status": "succeeded",
    "transfer_reversal": null
}

//get refund
$response = $this->stripe->get_refund('refund_id');
//return the same of create refund response, but with updated status

//cancel refund in rare cases
$response = $this->stripe->cancel_refund('refund_id');
```

API Documentation
-----------------

[](#api-documentation)

For more details about the Stripe API, refer to the official documentation:

[Stripe API](https://docs.stripe.com/api)

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~78 days

Total

4

Last Release

129d ago

Major Versions

1.0.0 → 2.0.02025-06-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/058005445fca254ef9441c3e3c2d44f687888160d542fe1cead1be1bb4b34bba?d=identicon)[bajjour.89@gmail.com](/maintainers/bajjour.89@gmail.com)

![](https://www.gravatar.com/avatar/0b5af85349dbf75d37b7801c1232a1e0d625160bb66bb863065ecea028070b18?d=identicon)[HebaAj](/maintainers/HebaAj)

---

Top Contributors

[![bajjour](https://avatars.githubusercontent.com/u/1816757?v=4)](https://github.com/bajjour "bajjour (7 commits)")

### Embed Badge

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

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

###  Alternatives

[laraveldaily/laravel-invoices

Missing invoices for Laravel

1.5k1.3M4](/packages/laraveldaily-laravel-invoices)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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