aimeos/pagible-cashier
Composer 安装命令:
composer require aimeos/pagible-cashier
包简介
Pagible CMS - Payment integration via Laravel Cashier
README 文档
README
Payment integration for Pagible CMS via Laravel Cashier. Supports Stripe, Paddle, and Mollie payment providers.
This package is part of the Pagible CMS monorepo.
Installation
composer require aimeos/pagible-cashier
Run the interactive installer to configure your payment provider:
php artisan cms:install:cashier
The installer will:
- Publish the configuration file
- Prompt for your payment provider (Stripe, Paddle, or Mollie)
- Collect API credentials and write them to
.env - Install the required Cashier package
- Add the
Billabletrait to your User model - Print webhook setup instructions
Configuration
After installation, the configuration is available in config/cms/cashier.php:
return [ 'provider' => env('CMS_CASHIER_PROVIDER'), // 'stripe', 'paddle', or 'mollie' 'products' => [ 'price_xxx' => ['once' => true, 'action' => 'course_access', 'course_id' => '123'], 'price_yyy' => ['action' => 'premium'], ], ];
The products array maps payment provider price IDs to server-side metadata. Set once to true for one-time payments; omit it for subscriptions. Only price IDs listed here are accepted by the checkout endpoint. The full product array is forwarded to the payment provider as metadata and available in webhook events.
Each provider requires its own Cashier package:
| Provider | Package |
|---|---|
| Stripe | laravel/cashier |
| Paddle | laravel/cashier-paddle |
| Mollie | mollie/laravel-cashier-mollie |
Environment Variables
| Variable | Description | Required |
|---|---|---|
CMS_CASHIER_PROVIDER |
Payment provider: stripe, paddle, or mollie |
Yes |
STRIPE_KEY |
Stripe publishable key | Stripe |
STRIPE_SECRET |
Stripe secret key | Stripe |
STRIPE_WEBHOOK_SECRET |
Stripe webhook signing secret | Stripe |
PADDLE_SELLER_ID |
Paddle seller ID | Paddle |
PADDLE_AUTH_CODE |
Paddle API auth code | Paddle |
PADDLE_RETAIN_KEY |
Paddle Retain key | No |
PADDLE_SANDBOX |
Use Paddle sandbox: true or false |
No |
PADDLE_WEBHOOK_SECRET |
Paddle webhook secret | Paddle |
MOLLIE_KEY |
Mollie API key | Mollie |
Checkout Form
The checkout form only needs the price ID. Payment type and metadata are resolved server-side from the products config:
<form method="POST" action="/cmsapi/cashier"> @csrf <input type="hidden" name="priceid" value="price_xxx"> <button type="submit">Buy Course</button> </form>
Guest users are automatically redirected to the login page. After login or registration, they are redirected back to complete the checkout.
Webhook Events
Each payment provider confirms payments via webhooks. Listen to these events in a service provider to perform actions on successful payments. Use the metadata from the products config to dispatch different actions per product.
Stripe
use Laravel\Cashier\Events\WebhookHandled; Event::listen(WebhookHandled::class, function ($event) { $payload = $event->payload; // One-time payment completed if (($payload['type'] ?? '') === 'checkout.session.completed') { $session = $payload['data']['object'] ?? []; $userId = $session['customer'] ?? null; $items = \Laravel\Cashier\Cashier::stripe()->checkout->sessions->allLineItems($session['id'] ?? ''); $priceId = $items->data[0]->price->id ?? null; $product = config('cms.cashier.products')[$priceId] ?? []; if ($userId && $user = User::where('stripe_id', $userId)->first()) { // grant access based on $product config } } // Recurring payment succeeded if (($payload['type'] ?? '') === 'invoice.payment_succeeded') { $userId = $payload['data']['object']['customer'] ?? null; $priceId = $payload['data']['object']['lines']['data'][0]['price']['id'] ?? null; $product = config('cms.cashier.products')[$priceId] ?? []; if ($userId && $user = User::where('stripe_id', $userId)->first()) { // grant access based on $product config } } });
Paddle
use Laravel\Paddle\Events\WebhookHandled; Event::listen(WebhookHandled::class, function ($event) { $payload = $event->payload; // One-time payment completed if (($payload['event_type'] ?? '') === 'transaction.completed') { $data = $payload['data'] ?? []; $userId = $data['customer_id'] ?? null; $priceId = $data['items'][0]['price']['id'] ?? null; $product = config('cms.cashier.products')[$priceId] ?? []; if ($userId && $user = User::where('paddle_id', $userId)->first()) { // grant access based on $product config } } // Recurring subscription activated if (($payload['event_type'] ?? '') === 'subscription.activated') { $data = $payload['data'] ?? []; $userId = $data['customer_id'] ?? null; $priceId = $data['items'][0]['price']['id'] ?? null; $product = config('cms.cashier.products')[$priceId] ?? []; if ($userId && $user = User::where('paddle_id', $userId)->first()) { // grant access based on $product config } } });
Mollie
use Laravel\CashierMollie\Events\OrderPaymentPaid; use Laravel\CashierMollie\Events\FirstPaymentPaid; // One-time payment completed Event::listen(OrderPaymentPaid::class, function ($event) { if ($user = $event->order?->owner) { $priceId = $event->order->orderItems->first()?->orderable_id; $product = config('cms.cashier.products')[$priceId] ?? []; // grant access based on $product config } }); // First recurring payment completed Event::listen(FirstPaymentPaid::class, function ($event) { if ($user = $event->payment?->owner) { $priceId = $event->payment->orderItems->first()?->orderable_id; $product = config('cms.cashier.products')[$priceId] ?? []; // grant access based on $product config } });
License
LGPL-3.0-only
aimeos/pagible-cashier 适用场景与选型建议
aimeos/pagible-cashier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 05 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「payments」 「stripe」 「mollie」 「laravel」 「cashier」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aimeos/pagible-cashier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aimeos/pagible-cashier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aimeos/pagible-cashier 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
Flexible payment integration for Laravel, lunarphp, supporting multiple payment providers.
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 39
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-only
- 更新时间: 2026-05-03