PHPackages                             amplifycode/transact - 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. amplifycode/transact

ActiveLibrary[Payment Processing](/categories/payments)

amplifycode/transact
====================

Payment Transaction Handling

v1.0.0(5mo ago)05PHP

Since May 8Pushed 5mo agoCompare

[ Source](https://github.com/amplify-code/transact)[ Packagist](https://packagist.org/packages/amplifycode/transact)[ RSS](/packages/amplifycode-transact/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (7)Used By (0)

Transact
========

[](#transact)

A Laravel package for handling payment transactions and subscriptions with Stripe.

Overview
--------

[](#overview)

Transact is a Laravel package that simplifies the integration of payment processing into your Laravel applications. It provides a clean, consistent interface for handling both one-time payments and recurring subscriptions through Stripe, with the architecture designed to support additional payment providers in the future.

Transact was originally developed by Kieran Metcalfe of Ascent Creative until his death in July 2025. This fork is maintained by Colin Cameron of Amplify Code Ltd in order to further develop and maintain websites that rely on this package.

Features
--------

[](#features)

- **One-time Payments**: Process single payments with Stripe
- **Subscriptions**: Handle recurring payments and subscription management
- **Webhook Support**: Process Stripe webhooks for payment status updates
- **Blade Components**: Ready-to-use UI components for payment forms
- **Polymorphic Relationships**: Associate transactions with any model in your application
- **Transaction Tracking**: Built-in database storage for transaction history

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

[](#installation)

### 1. Require the package via Composer

[](#1-require-the-package-via-composer)

```
composer require amplify-code/transact
```

### 2. Publish the configuration and assets

[](#2-publish-the-configuration-and-assets)

```
php artisan vendor:publish --provider="AmplifyCode\Transact\TransactServiceProvider"
```

### 3. Run migrations

[](#3-run-migrations)

```
php artisan migrate
```

### 4. Configure your environment variables

[](#4-configure-your-environment-variables)

Add the following to your `.env` file:

```
STRIPE_PUBLIC=your_stripe_public_key
STRIPE_SECRET=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_webhook_secret
STRIPE_TEST_CLOCKS=false

```

Updating assets
---------------

[](#updating-assets)

When updating this library, or installing your application, you will need to publish the latest js and css asset files to your application's public directory.

### 1. Update the published asset files

[](#1-update-the-published-asset-files)

```
php artisan vendor:publish --tag=public --force
```

Usage
-----

[](#usage)

### One-time Payments

[](#one-time-payments)

1. Implement the `iTransactable` interface on your model:

```
use AmplifyCode\Transact\Contracts\iTransactable;

class Order extends Model implements iTransactable
{
    public function getTransactionAmount(): float
    {
        return $this->total;
    }

    public function getTransactionDescription(): ?string
    {
        return "Payment for Order #{$this->id}";
    }

    public function onTransactionComplete()
    {
        // Handle successful payment logic
        $this->status = 'paid';
        $this->save();
    }
}
```

2. Process a payment:

```
use AmplifyCode\Transact\Transact;

$order = Order::find(1);
$paymentIntent = Transact::pay($order, $paymentMethodId);
```

### Subscriptions

[](#subscriptions)

1. Implement the `iSubscribable` interface on your model:

```
use AmplifyCode\Transact\Contracts\iSubscribable;
use Stripe\SubscriptionSchedule;

class Subscription extends Model implements iSubscribable
{
    public function getCustomerName(): string
    {
        return $this->user->name;
    }

    public function getCustomerEmail(): string
    {
        return $this->user->email;
    }

    public function getSubscriptionAmount(): float
    {
        return $this->plan_amount;
    }

    public function getSubscriptionDescription(): ?string
    {
        return "Subscription to {$this->plan_name}";
    }

    public function getStripeProductId(): string
    {
        return $this->stripe_product_id;
    }

    public function getInterval(): string
    {
        return 'month'; // or 'day', 'week', 'year'
    }

    public function getIntervalCount(): int
    {
        return 1; // e.g., 1 for monthly, 3 for quarterly
    }

    public function getIterations(): int
    {
        return 0; // 0 for unlimited, or specific number of billing cycles
    }

    public function getSubscriptionPhases(): array
    {
        return [
            [
                'items' => [
                    [
                        'price_data' => [
                            'currency' => 'gbp',
                            'product' => $this->getStripeProductId(),
                            'recurring' => [
                                'interval' => $this->getInterval(),
                                'interval_count' => $this->getIntervalCount(),
                            ],
                            'unit_amount' => $this->getSubscriptionAmount() * 100,
                        ],
                    ],
                ],
                'metadata' => [
                    'subscription_id' => $this->id,
                ],
            ],
        ];
    }

    public function onSubscriptionCreated(SubscriptionSchedule $sched)
    {
        // Handle subscription creation logic
        $this->stripe_subscription_id = $sched->id;
        $this->save();
    }

    public function onRecurringPayment()
    {
        // Handle recurring payment logic
    }
}
```

2. Set up a subscription:

```
use AmplifyCode\Transact\Transact;

$subscription = Subscription::find(1);
$setupIntent = Transact::setup($subscription, $paymentMethodId);
```

3. Start the subscription (typically called from a frontend callback):

```
$subscriptionSchedule = Transact::subscribe($setupIntentId);
```

### Using the Blade Components

[](#using-the-blade-components)

#### Stripe Elements

[](#stripe-elements)

```

```

#### Stripe UI

[](#stripe-ui)

```

```

Webhook Configuration
---------------------

[](#webhook-configuration)

Configure your Stripe webhook to point to:

```
https://your-domain.com/transact/stripe

```

Ensure the following events are enabled:

- `payment_intent.succeeded`
- `payment_intent.payment_failed`
- `invoice.payment_succeeded` (for subscriptions)
- `invoice.payment_failed` (for subscriptions)

License
-------

[](#license)

This package is developed by [Amplify Code](https://amplifycode.com) and [Ascent Creative](https://ascent-creative.co.uk).

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance70

Regular maintenance activity

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68% 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

Unknown

Total

1

Last Release

172d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2e9005f8b558f26eec15d1df1851b6ef5da184dd4f735502dfbf24b471c73b6?d=identicon)[colincameron](/maintainers/colincameron)

---

Top Contributors

[![kieranmetcalfe](https://avatars.githubusercontent.com/u/8314873?v=4)](https://github.com/kieranmetcalfe "kieranmetcalfe (51 commits)")[![colincameron](https://avatars.githubusercontent.com/u/1846118?v=4)](https://github.com/colincameron "colincameron (24 commits)")

###  Code Quality

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/amplifycode-transact/health.svg)

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

###  Alternatives

[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[simonhamp/laravel-stripe-connect

1343.1k](/packages/simonhamp-laravel-stripe-connect)[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)
