taut-id / payment
payment starter kit package
Fund package maintenance!
tautid
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/taut-id/payment
Requires
- php: ^8.3
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-data: ^4.17
- spatie/laravel-package-tools: ^1.16
- spatie/laravel-settings: ^3.4
- spatie/laravel-webhook-client: ^3.4
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
This package is not auto-updated.
Last update: 2025-10-14 10:53:59 UTC
README
A Laravel package for handling payment transactions with customizable state transitions and webhook integrations.
Installation
You can install the package via composer:
composer require tautid/payment
Publish the configuration file:
php artisan vendor:publish --tag="taut-payment-config"
Publish the webhook client migrations:
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-migrations"
Publish the payment migrations:
php artisan vendor:publish --tag="taut-payment-migrations"
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-config"
Run the migrations:
php artisan migrate
Important
Remove the default config in webhook-client after publishing.
This step is crucial to ensure proper configuration of the webhook client for your application.
Available Commands
This package provides two artisan commands:
1. Payment Due Command
Automatically changes pending payments to due status when they exceed their due date:
php artisan taut-payment:due
You can schedule this command to run periodically in your app/Console/Kernel.php
:
protected function schedule(Schedule $schedule) { $schedule->command('taut-payment:due')->hourly(); }
2. Make Transitions Command
Generates custom transition files for handling payment state changes:
Customizing Payment Transitions
You can add custom business logic to payment state changes by creating your own transition classes. This allows you to:
- Send notifications when payments are completed
- Update related models when payment status changes
- Log payment activities for audit trails
- Integrate with third-party services
- Execute custom business rules
Creating Custom Transitions
Use the provided command to generate transition files:
php artisan taut-payment:make-transitions
This will create the following transition files in your app/Transitions/Payment/
directory:
ToCanceled.php
- Executed when payment is canceledToCompleted.php
- Executed when payment is completedToDue.php
- Executed when payment becomes dueToPending.php
- Executed when payment becomes pending
Example Custom Transition
Each transition file extends the PaymentTransitionAbstract
class. Here's an example of customizing the ToCompleted
transition:
<?php namespace App\Transitions\Payment; use TautId\Payment\Abstracts\PaymentTransitionAbstract; use TautId\Payment\Models\Payment; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Log; class ToCompleted extends PaymentTransitionAbstract { public function handle(Payment $record): void { // Your extra step } }
Configuration
The transition namespace can be configured in your config/taut-payment.php
:
'transitions_namespace' => 'App\\Transitions\\Payment',
This allows you to organize your transitions in a different namespace if needed.