I do as described in the instructions
Route::get('/subscription-checkout/{plan_id}', function (Request $request, string $plan_id) {
return auth()->user()
->newSubscription('default', $plan_id)
->checkout([
'success_url' => route('subscription.success'),
'cancel_url' => route('subscription.error'),
]);
})->name('subscription');
In documentation:
When a customer visits this route they will be redirected to Stripe's Checkout page
But this code returns an object to me:
{
"id": "cs_test_a18z......",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": null,
"amount_subtotal": 3900,
"amount_total": 3900,
"automatic_tax": {
"enabled": false,
"status": null
},
"billing_address_collection": null,
"cancel_url": "http://example.com/subscription-error",
"client_reference_id": null,
"consent": null,
"consent_collection": null,
"currency": "usd",
"customer": "cus_MNtVxbbMUf8RF0",
"customer_creation": null,
"customer_details": {
"address": null,
"email": "[email protected]",
"name": null,
"phone": null,
"tax_exempt": null,
"tax_ids": null
},
"customer_email": null,
"expires_at": 1662579951,
"livemode": false,
"locale": null,
"metadata": [],
"mode": "subscription",
"payment_intent": null,
"payment_link": null,
"payment_method_collection": "always",
"payment_method_options": null,
"payment_method_types": [
"card"
],
"payment_status": "unpaid",
"phone_number_collection": {
"enabled": false
},
"recovered_from": null,
"setup_intent": null,
"shipping": null,
"shipping_address_collection": null,
"shipping_options": [],
"shipping_rate": null,
"status": "open",
"submit_type": null,
"subscription": null,
"success_url": "http://example.com/subscription-success",
"total_details": {
"amount_discount": 0,
"amount_shipping": 0,
"amount_tax": 0
},
"url": "https://checkout.stripe.com/pay/cs_test_a18znp............"
}
"laravel/cashier": "13",
"laravel/framework": "^8.75"
What is the problem?