API Connector for Stripe Subscription

Hi,

I’m hoping someone could help me.

I’m trying to set up the API Connector to connect with Stripe to create a subscription.

I’ve been using the Stripe.js plugin, which has been great, but it doesn’t allow me to set the trial_end variable, which I need.

I’m sure I’m not setting things up properly… Would anyone have an idea what might be wrong?

Here’s my setup in the API Connector:

And for the specific call:

and here’s the error I get when initializing:

Any help would be appreciated!

Here’s Stripe documentation, for reference:

Thanks in advance,

Jeff

1 Like

First, read the error message.

It’s telling you “Hey, your payload should be form-url encoded. Is it?”

And indeed, it’s not. (Your Body type is set to JSON. Change that.)

This error message is super clear and helpful. Are people just afraid of error messages or something? They almost always tell you exactly what the problem is.

(The exception is the General API failure… Which is usually caused by not having set a content-type at all.)

Hey @Jeff66

It’s true, sometimes you have the need to create your own call, but I think in this case you can stick with the plugin – Trial end is supported on stripe.js.

Here’s a shot of how I’m using it, which is to grab the trial days (not trial end) from the plan, and convert it to what is needed for trail end on a subscription:

But maybe you really do need your own api call. If so, definitely get the content-type stuff straightened out as Keith suggests, but also take a look at the authorization – you should only need either HTTP Basic Auth OR The Authorization key with Bearer – I don’t think you need both. If setting the Authorization key, your Authentication can be set to None or self-handled.

Here’s an example:
Auth (no password needed since the key in username is everything stripe needs)

With a call (I use json, not form-data):

The items in the call with <> will expand into parameters which you can further set.

1 Like

Stripe should accept JSON if you set the header name as “Content-Type” instead of “type”.

1 Like

Thank you. This helped in terms of getting me one step closer, but I’m still getting an error.

I did see what you’re showing there, but that is when creating the subscription for the Platform. My system requires that I create it for the Seller, which is why it seems I need to do my own API Call…

What you provided was very helpful - I’m getting a different error, which is I believe related to the fact that the I’m trying to do it on behalf of a Connected account (a Platform Seller).

Here is what I have set:

Do you have any idea of how to do this on behalf of a Connected account? (I see the error message, but I’m not sure specifically what to do about it…)

Thanks in advance,


Side note: @keith, I think the problem is that I find the API Connector a little difficult to use, as it’s not as clear to figure things out as other things in Bubble…

When it says to “check that your POST contest type is application/x-www-form-urlencoded”, I get that that’s the error, but I don’t have a clear idea of exactly what to change (which field) to get it to conform to that…

I believe I got it.

It required an extra level of authentication because I was doing it “on behalf” of the Connected account.

Had to do this:

Thanks for the help/feedback guys.

Much appreciated