shaanid/paypal-package
最新稳定版本:v1.0.0
Composer 安装命令:
composer require shaanid/paypal-package
包简介
A PayPal integration package for Laravel.
README 文档
README
A production-standard Laravel package for PayPal REST API integration, featuring robust error handling, transaction persistence, and audit logging.
🚀 Features
- Service-Oriented Architecture: Decoupled payment logic.
- Database Persistence: Automatic tracking of every transaction (Pending, Completed, Canceled, Failed).
- Audit Logging: Full traceability of API requests and responses.
- Action Pattern: Clean, testable, and reusable business logic.
- Ready-to-use UI: Modern, responsive checkout interface.
🛠️ Installation
-
Install via Composer: (Since this is currently a local package, you would typically add it to your
repositoriesincomposer.json)"repositories": [ { "type": "path", "url": "../path-to-your-package" } ]
Then run:
composer require shaanid/paypal-package
-
Publish Configuration and Views:
php artisan vendor:publish --provider="Shaanid\PayPal\PayPalServiceProvider" -
Environment Configuration: Add your PayPal credentials to your
.envfile:PAYPAL_MODE=sandbox PAYPAL_SANDBOX_CLIENT_ID=your_client_id PAYPAL_SANDBOX_CLIENT_SECRET=your_client_secret PAYPAL_CURRENCY=USD
-
Run Migrations:
php artisan migrate
📁 Usage
The package automatically registers the following routes:
GET /paypal: The checkout index page.POST /paypal/process: Handles order creation and redirection to PayPal.GET /paypal/success: Handles successful payment capture.GET /paypal/cancel: Handles payment cancellation.
Overriding Logic
You can use the Actions and Services provided by the package in your own controllers:
use Shaanid\PayPal\Actions\CreatePayPalOrderAction; use Shaanid\PayPal\DTOs\PaymentData; public function checkout(CreatePayPalOrderAction $action) { $data = new PaymentData(amount: '20.00', currency: 'USD', userId: auth()->id()); $approvalLink = $action->execute($data->toCollection()); return redirect()->away($approvalLink); }
📝 License
This project is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-07