Laravel Cashier支付确认页发布及使用问题咨询
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.
3. Link to the Payment Page Correctly
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-viewstag andPaymentControllerapproach should work. Runcomposer show laravel/cashierto 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

