You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel Cashier支付确认页发布及使用问题咨询

Troubleshooting Laravel Cashier's Missing cashier.payments Page

Hey there! Let's work through this issue with Laravel Cashier's payment page styling and routing. I've run into similar confusion before, so here's what I know:

1. Fix the Vendor Publish Command First

The command you tried (php artisan vendor:publish --tag="cashier-payment") is incorrect. The proper tag for publishing Cashier's view files is cashier-views. Run this instead:

php artisan vendor:publish --tag="cashier-views"

This will copy Cashier's default views (including the payments page if your version supports it) into resources/views/vendor/cashier/, where you can fully customize the styling.

2. Register the Missing Route Manually

Laravel Cashier doesn't auto-register the cashier.payments route for you—you need to add it to your routes/web.php file yourself. Here's the code to do that:

use Laravel\Cashier\Http\Controllers\PaymentController;

Route::get('/payments/{payment}', [PaymentController::class, 'show'])->name('cashier.payments');

This route points to Cashier's built-in PaymentController, which handles displaying the payment details page.

To send users to this page after initiating a payment, use the payment instance to generate a redirect link. For example, after creating a charge:

$payment = $user->charge(1000, 'payment-method-id'); // $user should be your Billable model

return redirect()->route('cashier.payments', $payment);

4. Check Your Cashier Version for Compatibility

If the above steps don't work, it's likely a version mismatch:

  • Cashier v14+: Newer versions rely heavily on Stripe's Hosted Checkout Pages instead of a native Laravel view. If this is your case, customize styling directly in your Stripe Dashboard (under Settings > Branding) rather than Laravel views.
  • Older Cashier versions (v13 or earlier): The cashier-views tag and PaymentController approach should work. Run composer show laravel/cashier to check your version and cross-reference with the corresponding Cashier docs.

5. Double-Check the Right Vendor Directory

Note that Cashier is maintained by Laravel, not Stripe—so you should look in vendor/laravel/cashier/resources/views (not vendor/stripe) for the default payment views. You'll find a payments folder with show.blade.php if your version supports the native page.

内容的提问来源于stack exchange,提问作者maganthro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 11:05:20