Invalid request (check that your POST content type is application/x-www-form-urlencoded)
I recreated the call multiple times, removed all optional flags, didn’t add any extra headers, and ensured Authorization is correct:
Authorization: Bearer sk_test_...
Question:
Does Bubble’s Form-data body type actually send multipart/form-data instead of application/x-www-form-urlencoded?
Or is there any specific setting required to make Form-data produce a proper x-www-form-urlencoded body for Stripe?
Has anyone successfully initialized Stripe Checkout using Form-data in API Connector?
By the way, there’s probably 1000+ forum posts about how to configure stripe in API connector and probably more than 10 tutorial video available. Please take time to search them before asking a question probably already answered
You are right that Bubble’s Form-data body type sends multipart/form-data, not application/x-www-form-urlencoded which Stripe requires.
Here is what you need to do:
Instead of using Form-data, set the Body type to None and manually add each parameter as a URL parameter in the API Connector. Bubble will automatically encode these as x-www-form-urlencoded when sent.
Alternatively, you can use Body type = Raw and manually build the request body in the format:
mode=payment&success_url=YOUR_URL&cancel_url=YOUR_URL&line_items[0][price_data][currency]=usd&line_items[0][price_data][unit_amount]=1000&line_items[0][price_data][product_data][name]=Test&line_items[0][quantity]=1
And add this header manually:
Content-Type: application/x-www-form-urlencoded
Another option is to use the official Stripe plugin for Bubble which handles all this for you.
If you want to stick with the API Connector, the cleanest approach is to pass parameters as query string parameters (check “Querystring” instead of “Body”) - Bubble sends these correctly formatted.
The key issue is that Stripe API is older and uses form-urlencoded format, while Bubble’s Form-data option uses the newer multipart format which Stripe does not accept.