#B33fb0n3YT-create-subscription

1 messages ยท Page 1 of 1 (latest)

pine comet
thin terrace
#

Yes, but I cannot set any Header with axios, or could I?

whole mist
#

axios is client-side right?

#

you shouldn't be doing any of this client-side, it requires your Secret key. You need a server for that

thin terrace
#

thanks ๐Ÿ™‚

whole mist
#

I really don't understand what you said

#

Are you using Axios server-side? why don't you just use stripe-node instead?

thin terrace
#

stripe-node?
I dont know how to use node.js in any way. Never worked with it.
Your API is a Rest API, isn't it?

whole mist
#

I'm totally lost. Let's take a step back: where is your code running? In a browser?

thin terrace
#

I created a project with React. So I start a development server on localhost:3000 (npm start). This is for testing. After I tested everything I going to build and upload it to aws.

whole mist
#

yeah I still worry we're talking past each other right now

#

React is also client-side in almost all cases

thin terrace
whole mist
#

Stripe requires server-side code. You will have to right code server-side for the majority of your integration, it can not run in the browser

#

if it did, anyone could look at the source code and find your secret key and do whatever they want with it

thin terrace
thin terrace
whole mist
#

you write server-side code

thin terrace
whole mist
#

I mean you have no choice?

#

I'm not sure how to say this. You can not make API requests with a secret key client-side with Axios, this is a huge security risk and doesn't make sense

thin terrace
whole mist
#

do not try to use the Secret key client-side in a browser

thin terrace
whole mist
#

you're unfortunately not listening to me

#

You can not do this. React js is only for client-side code to collect card details and nothing else

thin terrace
#

How do I get a list of all my subscriptions? A time ago I spoke to a team member from stripe. He said, that I can do it like that... ๐Ÿค”

#

Maybe you can see my old thread

#

cloud I do requests to these endpoints?

whole mist
thin terrace
#

so I cannot use stripe if I using react. Do I understood this right?

#

*only for collecting data

whole mist
#

I am so sorry, I don't understand why we are not understanding each other at all at this point

thin terrace
#

oh

whole mist
#

Stripe is a payments API first. You do things server-side and then client-side you collect card details in a nutshell. React is a client-side framework. We absolute support React, we have an official library for it, we have docs everywhere about it too. But React is client-side and only works for collecting card details for example
You can not list subscriptions or do anything client-side beyond accepting a payment

thin terrace
thin terrace
#

than I need to find another provider for my payment transfers :()

whole mist
#

I really don't understand what that could mean. The majority of processors work that way. You can't, as a developer, accept payments and do everything in a browser with your secret key, that is just impossible

#

I do think you are mostly confused/lost and that's not really what you want though

thin terrace
thin terrace
thin terrace
whole mist
#

Payment Links will create the subscription for you though

#

so you could have your own landing page in react that offers various products and each button is associated to a pre-configured payment link and you redirect the customer there

#

would that work?

thin terrace
#

That is, what I want to do:

#

it's in german...

#

the green box is the paid area.

whole mist
#

yeah I don't speak German and can't really help with something so high level

#

but really, you're the developer, you have a website, a server and server-side code is always required whether you take payments or not

thin terrace
#

yeah. I thought, that I collect the data from the customer, create the subscription via POST Rest API Call, transfering the data to stripe and stripe do the payments... but thats not worrking...

whole mist
#

yeah I keep telling you you can't do that

#

if you do that, anyone on your site can see your key and refund all your charges

#

you never want that

thin terrace
#

ok. One last question: Stripe have no Rest API, right or wrong?

whole mist
#

...

#

We have a Rest API. It's clearly documented here: https://stripe.com/docs/api. Having a rest API doesn't mean you can make whatever call you want client-side

#

I'm sorry, I am not trying to be mean or anything, but you are going to put your business at risk if you continue in that direction and don't want to hear that this is impossible, both on Stripe and any other payment processor

thin terrace
#

My secret key is save inside my .env file. I think I need one at my future provider, but it's save inside.

whole mist
#

you're not listening

#

wherever it's saved doesn't matter. Your code will need to retrieve it from your server to make calls client-side

#

if it's in the browser anyone can go and find it in seconds

thin terrace
whole mist
#

if you return the key yes

thin terrace
whole mist
#

if your code will retrieve what from where?

thin terrace
thin terrace
whole mist
#

then why do you say you're going to find a competitor and Stripe doesn't work for you?

#

So you are going to hit your server and have your server-side code access the data and return what's relevant to the client? Because if so that's exactly how your integration should be built!

thin terrace
whole mist
#

I... don't understand that sentence again I'm sorry ๐Ÿ˜ฆ

#

Your client-side code, in React, makes an ajax request to your server and your server-side code (in whichever language you use) uses our API + official client library to retrieve data you need. Or you store detailed information in your own database)

thin terrace
thin terrace
waxen geode
#

Yep, many Stripe API calls need to be made using a secret key securely from a backend server that you control.

#

That's right: you do your client > your server > Stripe API and then the responses go back the other way

thin terrace
#

oh thats not for me. I am a frontend developer and have no backend. So I cannot create backend by myself. So I cannot use Stripe ๐Ÿ˜ฆ

waxen geode
#

You can use Stripe -- for example using the payment links @whole mist mentioned earlier. Those require no back end.

#

You cannot implement a custom payment or subscription flow without a back end server, that is true. But we have products that can be used to collect payments and create subscriptions without a server. (Payment Links, Hosted Invoices)

#

You can create the invoices from the dashboard

thin terrace
#

yeah thats true. But I cannot check if the my customer currently have a running subscription (only with frontend + rest api).

thin terrace
waxen geode
#

That's true, you can't do any of that without a server

#

You need a server to make secret key requests, you cannot make secret key requests securely from the client

whole mist
#

At this poin we should stop unfortunately

#

if @thin terrace has never written server-side code and doesn't plan to write any or hire a developer to do this the discussion is moot. Though you will have the same problem on every API/processor

thin terrace
#

Ok. If I found one, I will let you know ๐Ÿ™‚

#

If u want, you can close this thread now

waxen geode
#

Will do - good luck with your project!

#

Archiving this thread ๐Ÿ—„๏ธ

thin terrace
#

Thanks! ๐Ÿ™‚