Download the PHP package sayed/payment-laravel without Composer
On this page you can find all versions of the php package sayed/payment-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sayed/payment-laravel
More information about sayed/payment-laravel
Files in sayed/payment-laravel
Package payment-laravel
Short Description A comprehensive Laravel payment integration package supporting Stripe, PayPal, and Paddle with unified interface, webhooks, and invoice payments
License MIT
Homepage https://github.com/johirulalam/payment
Informations about the package payment-laravel
User Guide - How to Use This Package in Your Laravel Application
This guide provides step-by-step instructions for integrating the Sayed Payment Laravel package into your application.
Table of Contents
- Installation
- Configuration
- Basic Setup
- Creating Payments
- Handling Webhooks
- Advanced Features
Installation
Step 1: Install the Package
Install via Composer:
Step 2: Publish Configuration
Publish the configuration file:
This creates config/payment.php in your application.
Configuration
Step 3: Add Environment Variables
Add your payment provider credentials to .env:
Step 4: Verify Configuration
Check config/payment.php to ensure providers are configured:
Basic Setup
Step 5: Create Payment Controller
Create a controller to handle payments:
app/Http/Controllers/PaymentController.php:
One-Time Payment
Subscription Payment
Multiple Products
Invoice Payment (Stripe Only)
Refund Payment
Product Creation
Create products and subscription plans programmatically across all payment providers. All methods return DTOs for type-safe access.
Create One-Time Product
Create Recurring Subscription
PayPal Product Creation
Paddle Product Creation
Advanced Features
Dynamic Provider Selection
Using PaymentMethod Enum
Custom Metadata
Get Invoice Details (Stripe)
Event-Driven Architecture
The package provides an event-driven architecture that allows you to easily handle payment events by creating custom event classes.
How It Works
When a webhook is received:
- The package validates and transforms the webhook data
- It dispatches events based on the event type (invoice, checkout, subscription)
- Your custom event classes are automatically instantiated and their
handle()method is called - You can also listen to these events using Laravel's event listener system
Step 1: Create Your Event Classes
Create event classes in app/Events by extending the base event classes provided by the package:
Invoice Events
Checkout Events
Subscription Events
Step 2: Register Events in Config
Update config/payment.php to map webhook events to your custom classes:
Step 3: Access Event Data
Your event classes have access to the following properties:
InvoiceEvent Properties
CheckoutEvent Properties
SubscriptionEvent Properties
Step 4: Using Laravel's Event System (Optional)
You can also use Laravel's native event listeners:
Create a Listener:
Register in EventServiceProvider:
Listener Example:
Available Event Names
Stripe Event Mapping
| Stripe Event | Simplified Name | Event Type |
|---|---|---|
checkout.session.completed |
completed |
checkout |
checkout.session.expired |
expired |
checkout |
customer.subscription.created |
created |
subscription |
customer.subscription.updated |
updated |
subscription |
customer.subscription.deleted |
deleted |
subscription |
customer.subscription.trial_will_end |
trial_ending |
subscription |
invoice.created |
created |
invoice |
invoice.finalized |
finalized |
invoice |
invoice.paid |
payment_succeeded |
invoice |
invoice.payment_failed |
payment_failed |
invoice |
invoice.updated |
updated |
invoice |
Real-World Example
Here's a complete example of handling invoice payments:
All versions of payment-laravel with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
stripe/stripe-php Version ^13.0|^14.0|^15.0
guzzlehttp/guzzle Version ^7.0