PHPackages                             fintechsystems/payfast-onsite-subscriptions - 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. fintechsystems/payfast-onsite-subscriptions

ActiveLibrary[Payment Processing](/categories/payments)

fintechsystems/payfast-onsite-subscriptions
===========================================

A Laravel service provider and Livewire blades for Payfast subscription billing

v3.3(5mo ago)3579[1 PRs](https://github.com/fintech-systems/payfast-onsite-subscriptions/pulls)MITPHPPHP ^8.3CI passing

Since Jun 6Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/fintech-systems/payfast-onsite-subscriptions)[ Packagist](https://packagist.org/packages/fintechsystems/payfast-onsite-subscriptions)[ Docs](https://github.com/fintechsystems/payfast-onsite-subscriptions)[ GitHub Sponsors](https://github.com/FintechSystems)[ RSS](/packages/fintechsystems-payfast-onsite-subscriptions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (37)Used By (0)

About Payfast Onsite Subscriptions
----------------------------------

[](#about-payfast-onsite-subscriptions)

[![GitHub release (latest by date)](https://camo.githubusercontent.com/fc481c5f7a69038d6a9ed3de64dcafb121ca561f8f1fbd9677146791d766e029/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f66696e746563682d73797374656d732f706179666173742d6f6e736974652d737562736372697074696f6e73)](https://camo.githubusercontent.com/fc481c5f7a69038d6a9ed3de64dcafb121ca561f8f1fbd9677146791d766e029/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f66696e746563682d73797374656d732f706179666173742d6f6e736974652d737562736372697074696f6e73) [![Tests](https://github.com/fintech-systems/payfast-onsite-subscriptions/actions/workflows/tests.yml/badge.svg)](https://github.com/fintech-systems/payfast-onsite-subscriptions/actions/workflows/tests.yml/badge.svg)[![GitHub](https://camo.githubusercontent.com/241f6013f770e07ca0ee9e37e6dd4f70296ce3102fc26bc1c552c1dcc5fe5c42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f66696e746563682d73797374656d732f706179666173742d6f6e736974652d737562736372697074696f6e73)](https://camo.githubusercontent.com/241f6013f770e07ca0ee9e37e6dd4f70296ce3102fc26bc1c552c1dcc5fe5c42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f66696e746563682d73797374656d732f706179666173742d6f6e736974652d737562736372697074696f6e73)[![Downloads](https://camo.githubusercontent.com/126490ee85b8a30aa99d7fcc243e85256340e810e2031e512fd98353d61d7cb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66696e7465636873797374656d732f706179666173742d6f6e736974652d737562736372697074696f6e732e737667)](https://packagist.org/packages/fintechsystems/payfast-onsite-subscriptions)

A [Payfast Onsite Payments](https://developers.payfast.co.za/docs#onsite_payments) implementation for Laravel designed to ease subscription billing. [Livewire](https://laravel-livewire.com/) views are included.

Requirements:

- PHP 8.3
- Laravel 11.x or higher
- A [Payfast Sandbox account](https://sandbox.payfast.co.za/)
- A [Payfast account](https://www.payfast.co.za/registration)
- Sanctum

If you want to use Laravel Nova, version 4 is required for the `Subscription` and `Receipt` resources.

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

[](#installation)

Install the package via composer:

```
composer require fintechsystems/payfast-onsite-subscriptions
```

If you don't have Sanctum already:

```
php artisan install:api
```

Publish Configuration and Views
-------------------------------

[](#publish-configuration-and-views)

Publish the config file with:

```
php artisan vendor:publish --provider="FintechSystems\Payfast\PayfastServiceProvider" --tag="config"
```

Publish the Success and Cancelled views and the Livewire components for subscriptions and receipts.

```
php artisan vendor:publish --provider="FintechSystems\Payfast\PayfastServiceProvider" --tag="views"
```

These files are:

```
banner.blade.php
billing.blade.php
cancel.blade.php
pricing.blade.php
receipts.blade.php
subscriptions.blade.php
success.blade.php
```

Setup
-----

[](#setup)

Add the `Billable()` trait to your user model.

```
use FintechSystems\Payfast\Billable;

class User extends Authenticatable
{
    /** @use HasFactory */
    use HasFactory, Notifiable;
    use Billable;
```

In your header
--------------

[](#in-your-header)

```
@if (config('payfast.test_mode'))

@else

@endif

@stack('payfast-event-listener')
```

To include the pricing component on a page, do this:

In your header:

```
@vite(['resources/css/app.css', 'resources/js/app.js'])
```

In your view:

```
@include('payfast::components.pricing')
```

### Nova Integration

[](#nova-integration)

Optionally publish Laravel Nova Subscription and Receipts Resources and Actions

```
php artisan vendor:publish --provider="FintechSystems\Payfast\PayfastServiceProvider" --tag="nova-resources"
```

Migrations
----------

[](#migrations)

A migration is needed to create Customers, Orders, Receipts and Subscriptions tables:

```
php artisan migrate
```

Example Configuration
---------------------

[](#example-configuration)

`config/payfast.php`:

```
