Stripe Checkout - line_items not found

I had a working checkout on 3.9.1 but this is no longer working on 3.9.2.

I’m now using Custom Reference (I think 3.9.1 it was just Reference).

What the stripe checkout payload contains:

Screen Shot 2021-03-26 at 10.22.13 AM

The error received:

Screen Shot 2021-03-26 at 10.22.43 AM

My checkout.session on the server:

Did something change on the 3.9.2 update?

This price id shown in the payload is a valid price id from stripe.

For the regular price( stripe price id), quantity you should use reference.

Custom reference is a new type that allows you to pass array of fully custom products, not defined in stripe.

It has as properties: title, amount, currency and quantity.

It is explained in the doc about custom products checkout.

Okay, I’m back to “Reference” items type.

Now getting:

options.line_items.map is not a function

returned by checkout session action on server.

I’m currently providing a subscription price id on the Line items value on the front end, which produces that error.

If I provide the price id inside the checkout session action with a Items type of Prices ID List, everything works.

I can’t figure out what has changed as this was all working with the first iteration of the Stripe release.

What was the value on the front end?

It is supposed to be an array.

But I will see if we can make it smarter

Okay, an array of price ids?

an array of objects with price, quantity in them
where price is the stripe price_id

I think this was explained in the first Stripe docs tutorial but because we used a Data Store there it might not have being clear that it is an array.

Okay, that helps. Thanks for the late night assist George.

I’m going to feel so stupid once I figure this out!

Sending to stripe checkout:

Screen Shot 2021-03-26 at 2.43.59 PM

Getting back;

Subscriptions require at least one recurring price or plan to be passed to `line_items`. See https://stripe.com/docs/payments/checkout/set-up-a-subscription#create-checkout-session. If you didn't intend to create a subscription, use payment `mode` instead. Learn more at https://stripe.com/docs/payments/checkout/accept-a-payment#create-checkout-session.

Well the Subscription flows were covered in:

Both Client Side Only flow and Server Side - with reusing the Customer even.
So see if you have missed anything in your subscription definition, like the right price id and also setting the purchase mode to subscription.

Unfortunately those checkout.

To troubleshoot, I used that same price id but inside the checkout action itself, and changed from Reference to Prices ID List. That works fine.

I’ll keep at it.

Maybe you guys can check on your end as well @George.

I have now rebuilt the files…same result.

This is what shows as a request on the stripe portal:

No line_items object is being sent and so it fails:

However, if I use the Items Type of Prices ID List, it shows the request including line_items

1 Like

So what exactly is post to your server action for the create checkout session from the front end? That it doesn’t work.

Data store with the price and quantity

And the stripe element:

I mean in devtools could you inspect the exact post to server connect action

Sorry there was a bug indeed when passing the regular line_items.

Unzip and replace the stripe.js in lib/modules:
stripe.zip (7.1 KB)

Now we event improved create Session checkout to accept all kind of line items. A single price, or a Price/Quantity object or array of those.

So you can pass anything to it.

2 Likes

Thanks George…confirmed it is working.

1 Like

I just ran into to this issue too as @mebeingken was outlining I thought I was going crazy until I decided to check the forum here to see if anyone else was having this issue. I’ll unzip the file and replace it on my end too in the morning unless advice otherwise. Thanks @George and @mebeingken