I am using the API Connector to initiate a Stripe Checkout Session (type=payment).
However, the call requires me to input the Stripe Product/Quantity. Is there a way around this?
I want to simulate Bubble’s Stripe Plugin, which doesn’t require a product/quantity. Instead, it allows you to just input the dollar amount to charge, which is what I want.
Is this possible? Should I use a different call/approach?
Thanks!
Hey @markjkopelman - This is just how it fits in with their system of Price/Products.
They’ve mentioned it a couple places in their documentation where you can provide price data (quantity, price, name) on the fly with checkout (i.e. any $ value you want).
Try following the call in this section:
Thanks Djack! According to the documentation, it looks like the Checkout is going to require the line items and quantity - which is a deal-killer.
It seems like Bubble’s Stripe plugin uses the “Charge” API call (and this doesn’t require any products/quantities). The problem is that this is now a deprecated API call, and Stripe is encouraging users to use alternative calls like PaymentIntent or Checkout.
Does anyone have any experience using PaymentIntent with Stripe Checkout? Any downsides?
Payment intent is just beginning of the transaction, you will have to add payment method as well which may be another hassle. Stripe supports many payment methods and in checkout landing page stripe manages all of it for you, that’s why checkout link and customer portals are helpful. Customer portal allows for customer to view invoices, manage payment methods, manage subscription plans but you need to have subscription already active on user and it’s a little off topic from your question i suppose. If you need one time payment, i would use checkout session url.
I’m coming from developer background, built Stripe and other payment custom integrations many times yet not with Bubble. I would love to help you out at no cost and learn how you approach this in Bubble way. Probably could build you some plugin for this. Can we contact on LinkedIn, jump on call at some moment and i will help you figure this out, then publish solution here? What I want is understand better how Bubble builders, like yourself, think about these things and just learn from you while figuring this out you can check about my tech exp here: https://www.linkedin.com/in/lukas-liesis-05335626/
Hey @markjkopelman you can set whatever price you want and the quantity as 1 and you’ll get the results you desire (I think ).
So to create a “charge”, you can do so through:
- setting up any unique value payment through the Checkout or,
- creating and confirming a Payment intent (can be done in the same API call) using a customer’s saved payment method.
You can do this all through the API connector, no need for a plugin.
I believe that Charge API is indeed getting deprecated - The Payment intents in Stripe are the process of setting the up the payment and Authorising payment from the customer using their payment method (e.g. credit card) . Sometimes this happens in stages, sometimes it happens in one action.
If you’re aiming to initiate a Stripe Checkout Session with a custom dollar amount rather than specifying a product and quantity, you have a couple of options:
- Use the PaymentIntent API: Instead of setting up a full Checkout Session with specific products, you can create a
PaymentIntent
with a specified amount in cents. This way, you only need to pass the amount and currency, similar to how Bubble’s Stripe plugin handles one-time charges. You’ll need to manage the front-end UI for checkout, but it gives you more flexibility without the need for predefined products.
- Custom Line Item: If you prefer to stick with the Checkout Session approach, you can create a custom line item by passing an amount and quantity as metadata instead of referencing a specific product ID. This approach is a bit of a workaround, but it allows you to set an arbitrary charge amount.
- Use Bubble’s Stripe Plugin: Since the Bubble Stripe Plugin simplifies this process by allowing you to specify an amount directly, it might be worth using it if your requirements align with its functionality, especially for straightforward one-time payments.
Each method has its own pros and cons, but using PaymentIntent
directly might be the closest to what you’re looking for in terms of flexibility. Let me know if you’d like more details on any of these approaches!
Thank you all for your help!
I’m happy to report I got it working using the Checkout Session.
Earlier, I mentioned that Checkout Session requires a Stripe product/price when I used “line_items[0][price]”
I didn’t like this because I wanted product names to be passed in dynamically, on the fly without first being created in Stripe.
I learned that I could instead use “line_items[0][price_data][product_data][name]” and pass the text in dynamically, without creating prices in Stripe.
For reference, here are the resources I used to get it working. (Editor). Appreciate everyone’s help!