Stripe Checkout Session — Form-data in API Connector always fails with “check that your POST content type is application/x-www-form-urlencoded”

Hi everyone,
I’m trying to set up Stripe’s POST /v1/checkout/sessions using Bubble’s API Connector.

Stripe requires:

Content-Type: application/x-www-form-urlencoded

But when I use Body type = Form-data and pass even the minimal parameters:

mode=payment
success_url=...
cancel_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

…I always get the same Stripe error:

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?

Thanks!

Use raw instead body type instead

And share api connector srtting for more help

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:

  1. 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.

  2. 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

  1. Another option is to use the official Stripe plugin for Bubble which handles all this for you.

  2. 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.

1 Like