Closed edalzell closed 11 months ago
The work-around is to add the default fields:
->checkout([
'payment_method_collection' => 'if_required',
'subscription_data' => [
'metadata' => ['name' => 'default'],
'trial_period_days' => 14,
'trial_settings' => [
'end_behavior' => ['missing_payment_method' => 'cancel'],
],
],
])->redirect();
Hey @edalzell. Thanks for this. I believe you're right. I've sent in a PR for this: https://github.com/laravel/cashier-stripe/pull/1579
Cashier Stripe Version
14.12.7
Laravel Version
10.25.2
PHP Version
8.2.11
Database Driver & Version
No response
Description
I was trying to create a Checkout Session with a trial period and not collect payment information.
According to the Stripe docs, you need to set the payload to something like this:
However, if you pass that in to the
checkout
method, thearray_merge
gets rid of the "default" payload, including:I believe what's needed is
array_merge_recursive
instead ofarray_merge
hereSteps To Reproduce
Try to create a checkout session using:
And you'll see the metadata is missing from the Stripe request.