Download the PHP package fintechsystems/payfast-onsite-subscriptions without Composer
On this page you can find all versions of the php package fintechsystems/payfast-onsite-subscriptions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fintechsystems/payfast-onsite-subscriptions
More information about fintechsystems/payfast-onsite-subscriptions
Files in fintechsystems/payfast-onsite-subscriptions
Package payfast-onsite-subscriptions
Short Description A Laravel service provider and Livewire blades for Payfast subscription billing
License MIT
Homepage https://github.com/fintechsystems/payfast-onsite-subscriptions
Informations about the package payfast-onsite-subscriptions
About Payfast Onsite Subscriptions
A Payfast Onsite Payments implementation for Laravel designed to ease subscription billing. Livewire views are included.
Requirements:
- PHP 8.3
- Laravel 11.x or higher
- A Payfast Sandbox account
- A Payfast account
- Sanctum
If you want to use Laravel Nova, version 4 is required for the Subscription
and Receipt
resources.
Installation
Install the package via composer:
If you don't have Sanctum already:
Publish Configuration and Views
Publish the config file with:
Publish the Success and Cancelled views and the Livewire components for subscriptions and receipts.
These files are:
Setup
Add the Billable()
trait to your user model.
In your header
To include the pricing component on a page, do this:
In your header:
In your view:
Nova Integration
Optionally publish Laravel Nova Subscription and Receipts Resources and Actions
Migrations
A migration is needed to create Customers, Orders, Receipts and Subscriptions tables:
Example Configuration
config/payfast.php
:
Livewire setup
Views
The Livewire views are modelled to blend into a Laravel Jetstream user profile page.
Adding a billing menu
In app.blade.php
below in the Account Management sections (e.g., below profile):
Also look for the responsive part and add this:
Adding the subscriptions and receipts views
When calling the Livewire component, you can override any PayFast form field by specifying a mergeFields
array.
Example modification Jetstream Livewire's resources/views/profiles/show.php
:
Replace $user->name
with your first name and last name fields.
Usage
Examples
- Generate a payment link
- Create an adhoc token optionally specifying the amount
- Cancel a subscription
- Update a card
Testing
How to determine when a user's subscription ends
$user->subscription('default')->ends_at = [date in the past]
In your main project, add this:
Then do this to symlink the library:
If you want to test trials, use this one-liner to activate a billable user and a trial using Tinker:
To see if a user is on trial as used in the subscriptions blade, do this:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of payfast-onsite-subscriptions with dependencies
symfony/dotenv Version *
livewire/livewire Version *
moneyphp/money Version *
spatie/ray Version *
nunomaduro/collision Version *
guzzlehttp/guzzle Version *
guzzlehttp/psr7 Version *