#Songbox-advice
1 messages · Page 1 of 1 (latest)
hello
So... i was super excited when i got the email today about adding upsells to checkout.js
I have configured the upsells in my dashboard but they are not showing on the checkout
and i'm pretty certain i need to do something in the code - something about retrieving all line items?
but tried everything and I'm stuck.
I can show my code, if that's needed.
Yeah if you can share your code that'd be great!
ok cool... don't laugh
$pk = env('STRIPE_KEY');
$user = Auth::user();
$session = Session::create([
'customer' => $user->stripe_id,
'payment_method_types' => ['card'],
'subscription_data' => [
'items' => [
[
'plan' => $plan,
]
],
],
'allow_promotion_codes' => true,
'success_url' => env('APP_URL').'/account?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => env('APP_URL'),
]);
that is basically the controller that calls on the checkout session
I feel like where i have the "items" array it should be line items? I'm using a stripe package and it doesn't match the layout of the stripe docs code
I haven't played around too much with upsells yet so give me a second!
OK thanks, the key difference between what I have and whats in the docs is that i am calling on a "plan" where they are calling on "price" - but I have tried all combinations and variations of everything i can think of
Yep I noticed that too. Checking on whether upsells require the use of prices
ta
Yep I do think that is the issue. I'm seeing that we only support upsells with line item prices
ok so let me show you what i tried.. and it started going crazily wrng for me
So now this:
$session = Session::create([
'customer' => $user->stripe_id,
'payment_method_types' => ['card'],
'line_items' => [
[
'price' => 'price_HKkvFl2klRfub8',
'quantity' => 1,
],
],
'mode' => 'subscription',
'allow_promotion_codes' => true,
'success_url' => env('APP_URL').'/account?session_id={CHECKOUT_SESSION_ID}',
'cancel_url' => env('APP_URL'),
]);
is working but not showing any upsell
my question is, where do I pass in the "upsell"? is it as a second line item?
The upsell is set on the price itself via the Dashboard.
Looking at the price used in that code there is no upsell set for it.
Happy to help!
So defo added an upsell, defo using "price" in the api call
and still no upsell on te checkout page, as you can see
aargh crying baby... i need to disappear for a bit but i'm super keen to hear what you think here
No worries, come on back once you can. I'm taking a deeper look now!
ok baby seems to have settled so i'm still here
Oh ive solved it
and possibly found a bug for you guys
Please tell 🙂
so if you add the upsell by going into "edit price"
it doesnt work
but if you just click on the orice and add the upsell on that screen.... it does work
Interesting. That may have been why I am having trouble repro'ing on my own Dashboard.
yup and also... you can use plans. prices not required
you just need to add the upsell on the price page, and NOT the "edit price" page
even though the option is there to do so on te edit price page. Looks like it doesn't save correcly
Thanks for flagging that. I'm going to file internally to get this fixed up.