Use Business Logic to interface with Stripe?


I am trying to create a Stripe customer then assign the returned customerId to a Backendless User. I have tried to achieve this client-side but it seems to be impossible. Am I able to do this through Codeless functionality? I am also following your Stripe Integration Guide but it’s not clear on what its capabilities are.

Thank you.

Hi Stephen,

The Stripe plugin is built to handle the use-case which according to Stripe must be done on the server-side of an application to enable secure communication, that is, initiating a credit card charge.

I am wondering why creating a Stripe customer was not possible on the client-side. Could you please elaborate?


I have a thread at SO about it. I’ve been spinning my wheels on this for a while, trying several different approaches and packages.

Your post says you’re using Stripe node module, which someone commented is a server-side library. What do you have on the client side? Android, iOS, JS? I wonder if you can use Stripe’s own SDK to create a customer.

So is it not possible via Codeless?

Edit: yes, that was my latest attempt. JS—a Vue-based app. Trying to get Stripe’s SDK working with it is proving to be very difficult.

It is possible with Codeless, but you’d need to use the REST API to do that, it may be tedious. If Stripe’s SDK supports that API, it might be easier to do it directly from the client-side.

Here’s the REST request you’d need to implement in Codeless:

Thanks. That is what I am currently trying to do in Codeless. Do I have to drag the puzzle pieces around to build this? I cannot seem to paste the cURL command anywhere.

Yes, you will need to compose an HTTP request using the block shown below. You need to figure out how to pass the authentication header (the Stripe documentation doesn’t say what it should be formatted as).

1 Like

Stripe uses this kind of format for auth headers:

Authorization: Bearer SECRET_KEY

I haven’t yet figured out what blocks works to pass that through.

Do you see the “headers” connector in the HTTP/S block? You need to use to set the headers. It will look something like this:
Codeless - BL - ConsoleDemo - Backendless - Google Chrome 2020-05-01 19.39.50
The Bearer SECRET_KEY will be the value you need to put for the “Authorization” connector.

1 Like

Thank you, that works for the headers. Now I’m trying to format the request body and am running into errors. Some of this Codeless functionality isn’t as intuitive as it seems it should be.

400 - {“error”:{“message”:“Invalid request (check that your POST content type is application/x-www-form-urlencoded). If you have any questions, we can help at",“type”:"invalid_request_error”}}

What is the proper format of the request body here? In other words, what does Stripe expect to get?

It seems to be:

  email: '',

Oh, it turns out that I just needed to move the email object up to the query slot. When I have this all sorted, I’ll post the final configuration in case anyone else needs it.

Where do you see it in the Stripe docs? All I see is they want is “description”.

All of the parameters it accepts are optional, including description and email.

Looking at the Authorization header value here. You put a literal string “Bearer MY_KEY”. I don’t think it is right.

I don’t want to paste my actual key here but with my key in place of that, I successfully get a 200.


1 Like

For those who might need to do something similar, this is the final Codeless configuration. This allows a Backendless user to provide the current User’s email address, create a Stripe customer via their API, then update the User with the new Stripe customerId. Thanks for the assistance, @mark-piller.