Search by

roundly-consulting / purchases-for-laravel

mihaliak

Handle payments and subscriptions from Payment Gateways and In-App Purchases.

Package info

github.com/roundly-consulting/purchases-for-laravel

pkg:composer/roundly-consulting/purchases-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:14 UTC

This package is auto-updated.

Last update: 2026-10-03 18:36:03 UTC


README

Purchases for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Purchases for Laravel

One API for Apple App Store, Google Play and Stripe purchases and subscriptions. It verifies every store's webhooks natively, records purchases, subscriptions and refunds as Eloquent models, and fires lifecycle events, with no third-party SDKs.

Installation

Requires PHP 8.4 (ext-bcmath) and Laravel 12 or 13.

composer require roundly-consulting/purchases-for-laravel
php artisan purchases:install --providers   # publishes config + migrations, appends the providers' .env keys
php artisan migrate

If your owner models have UUID/ULID keys, set PURCHASES_KEY_TYPE before migrating. Fill in each provider's credentials (for Stripe, PURCHASES_STRIPE_WEBHOOK_SECRET) and set PURCHASES_ROUTES_ENABLED=true to receive webhooks at POST /purchases/webhooks/{provider}.

Usage

The bundled route verifies, records and fires events for you. From your own controller it is one call:

use RoundlyConsulting\Purchases\Facades\Purchases;

$model = Purchases::handle('stripe', $request);   // verify the signature, record, fire events

A store never says which of your users paid, so link the owner in a listener:

use App\Models\User;
use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Purchases\Events\SubscriptionStarted;

Event::listen(function (SubscriptionStarted $event): void {
    $customer = $event->result->raw()['customer'];          // the Stripe customer id

    $event->subscription->owner()->associate(User::firstWhere('stripe_id', $customer));
    $event->subscription->name = 'pro';                      // Stripe names no plan
    $event->subscription->save();
});

Then gate features on it:

Purchases::for($user)->subscribedTo('pro');          // true
Purchases::for($user)->activeSubscription('pro');    // ?Subscription

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/purchases-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

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