Multiple dynamic line_items in bubble API connector Stripe

Hi Bubble Community,

I’m trying to integrate Stripe’s Checkout Session API in my Bubble app to dynamically handle a service and multiple addon purchases. The core functionality I’m aiming for is to pass 1 service and 5 dynamically selected addons into the line_items array of the Checkout Session API call.

What I’ve Tried:

  • Hardcoding one line item works, but dynamic line items seem to cause the issue.
  • I’ve double-checked that each addon has a valid Stripe Price ID stored in my database.
  • The dynamic expression for the price field seems to be causing issues when more than one addon is selected.

Questions:

  1. How should I structure the line_items array in the API call to handle multiple dynamic addons?
  2. Is there a specific way to format dynamic data in the API Connector for Stripe that I might be missing?
  3. Has anyone successfully passed multiple dynamic line items to Stripe’s Checkout Session API using Bubble’s API Connector? If so, how did you handle retrieving and formatting dynamic Stripe Price IDs?

Any guidance or examples would be greatly appreciated!

Make the whole line item object in api call dynamic. Then depending on the liat, use ‘’‘format as text’‘’ on list qnd build each line item dynamically. You cant find the line item object in api doc for strip.

The line item itself is an array , object have currly braket {}.

It would be like this.

“Line_item” : [
Item01: { items details and parameters},
Item02: { items details and parameters},
Item03: { items details and parameters},
]

If you still stuck ping me, i would love to help.

1 Like

I appreciate your quick response Baloshi, i’ll give it a try and reach out to you!

Im getting this error when initializing the call, i don’t have JSON knowledge, maybe the code is wrong?



Bro the way you setup the call is wrong, you definitely need a walkthrough. I am sleeping right now. Will be awake after 8 hours.

Will you be available i will walk you through and help you out.

2 Likes

There’s already a lot of topics and solutions about that on the forum. Pretty sure There’s also a lot of youtube on how to set that.

Personnaly I prefer to use a json and convert it with this plugin JSON Serialize to URL query Plugin | Bubble

1 Like

Yes i’ll be available! Thank you

thanks, i’ll try the plugin.

1 Like

can you guide me in how to create the dynamic line_items with the plugin?

You don’t create it with the plugin, you create it in JSON and let the plugin serialize the JSON.

For line item, you already have the json in your body that is created. What you can do is to add a parameters “line_items”
And in this parameter you will put the result of the plugin

Your line item in the plugin will be something like[Do a search for line item:formatted as text]
In the formatted as text, you will put in the first box something like

{"price":"this item price","quantity":"this item quantity"}

(you will probably put more informations for line item (could be ID, description…)

1 Like

let me know if you’re available rn

@emiliogarciarios10 bro you online, ping me on linkedin or whatsapp , see my profile will love to help.

sorry i was budy with kids schools

Hey guys,

I’ve read a lot of forum posts about problems with line_items but I’m still stuck.

My initialize call is correct, I have the data displayed.
key : line_items
value : line_items[0][price]=price_1Q16iIBG8gDoGKFTHszpB2SN&line_items[0][quantity]=2&line_items[1][price]=price_1Q16ioBG8gDoGKFTt6kpNWO3&line_items[1][quantity]=10&

As soon as I want to make the call in a workflow, it throws me this error.

image

image

Do you have an idea of what I’m doing wrong ?

Thanks in advance,
Simon