#BinaryWritter-Subscriptions

1 messages ยท Page 1 of 1 (latest)

sly stream
#

Hi there! I believe you were working on this earlier this week and you were able to hit your server successfully then?

#

Can you tell me what point you are at right now?

remote loom
#

No i have never succeded sorry thats why im here again, i have given it a try again but no luck, same error Hello by the way !!!

#

I have copied the code from the Stripe examples about Subscriptions, added more subscriptions (added more divs for more subscriptions) but when i click checkout i get a not found error always no matter if the node server is running or not

sly stream
#

Okay can you share your code as it currently stands?

#

Can you also share your package.json

remote loom
#

Here they are, thank you for everything

#

First is subscriptions, second is subscriptions css, and third is package.json

sly stream
#

And your server code?

remote loom
#

Oh yes, sorry

#

this server code its in /pages/api/ folder

#

So i imagine the node server can access the server code

#

LOL so many users requiring your services

sly stream
#

Yes a bit busy right now!

#

Okay, looking!

#

Alright so when you add a log to your create-checkout-session endpoint on your server before you create the price, do you hit that log?

remote loom
#

Yes i will do it again to check

#

Yes it shows on console "Subscription Server"

#

what i wrote

sly stream
#

Okay that's good then

#

And are the Stripe requests working on that endpoint?

#

Are you creating a price and checkout session?

#

Also can you edit your code above to remove your secret key?

#

Even though it is your test key we still recommend not sharing that as it compromises your account

remote loom
#

The chekout its the one i use for normal payments, do i need to create another, the price i think i pass it in the EdaiplaySubscriptions

#

Im confused

#

So what do i do my friend?

#

I have made tests, do i re run the servers?

sly stream
#

So the create-checkout-session endpoint is your one-time payment endpoint?

#

In that case, yes you need another endpoint

#

And when you make changes on your server you do need to rerun your server each time.

remote loom
#

Oh not hot reloading? Ok Now that i think about it the create-checkout-session i only use it for Subscriptions, sorry

#

It still looks for localhost:3000 the create-checkout-session

sly stream
#

Okay so what happened on your server after you hit the log successfully?

#

The next thing was a request to create a Price

#

Was that Price created?

remote loom
#

Nothing the server continues to show my message and no more loggins, i need to mention that on my server code in the require('stripe') part theres a underline, like if it was a syntax error so i dont know if stripe is loaded in the server

#

Maybe becouse the create-checkout-session doesnt do anything?

sly stream
#

Your server terminal doesn't show any error or anything?

#

Do you see anything in your Stripe developer logs?

remote loom
#

Nothing, in my dashboard? havent checked

#

It only shows my message and "Running on port 4242

sly stream
#

Okay add a log after the Price creation and try to log out the Price variable

#

And yes, look in your Stripe Dashboard and see if there is any error

remote loom
#

i cant access my log the post /create-checkout-session is never executed because of the error, it seems code cant go further that error

sly stream
#

I'm confused

#

Where did you put your original log

remote loom
#

also it is running on port 4242 but the error is in localhost:3000/create-checkout-session Yes im also confused

#

The initial log i put it at the top of the code and executes, but besides that post error nothing more is executed

sly stream
#

Ah okay, I thought you put the log inside your endpoint

#

So can you share your server code once again without your secret key?

#

And with the log added

#

When you say "the error" are you talking about seeing that in your server or on your client?

remote loom
#

Seing that in my server terminal, in browser i get a 404 not found on localhost:3000/create-checkout-session

sly stream
#

Okay and to clarify, when does the Subscriptions Server log show up? Right when you start your server I assume

remote loom
#

Yes when i start the server the logs show

sly stream
#

Okay I think I know the issue. Can you try adding a proxy to your package.json. Like "proxy": "http://localhost:4242",

#

But you likely do need to be proxying your requests here to be able to hit your server

remote loom
#

With what command i run the express server? with node index.js ?

#

Dont seem to work, same error

#

Im on Linux

keen harbor
#

@remote loom unfortuantley the channel is really busy and this isn't really a Stripe-specific question and more a misunderstanding of Node/Express on your end

#

have you tried making this work without Stripe first? Making a really simple Node.js example that you are able to debug yourself as the developer and then adding Stripe to it

remote loom
#

Its related, you implement Stripe on Node/Express that you are busy yes i can understand that

keen harbor
#

I understand it's related to Stripe, but the error is purely a system error on your machine when starting/configuring Express itself

#

so I'm asking if you have already used Express yourself before? If you are unfamiliar with this, you might want to start by doing a basic/simple Express example, completely without Stripe to learn the basics

remote loom
#

I have read before implementing, the docs say to place the file in pages/api and run it with node "serverfilename"

keen harbor
#

Those are simple docs assuming that as a developer you are already really familiar with your own system (your framework, your language, etc.). If you are just starting, my advice is to learn the basics of Express and Node.js first before implementing payments

remote loom
#

Ok i will investigate more, but its the third day im with this issue, and now you are bussy

#

Anyway thank you

keen harbor
#

The problem is that you seem really lost on how to do a simple webserver

#

and that's really a step that is usually happening days/weeks before you plan to add payments to your application

#

I want to try and help but right now you seem to need more help from a professional developer/freelancer to teach you those basics before you start accepting real payments on a real website

#

Have you considered hiring someone tohelp you set this up first?

remote loom
#

Here i have found how to do it

keen harbor
#

ah nice, does this work now?

remote loom
#

Im shure it will a friend told me about it you can say other Next.js users to follow the video, i was already doing a sillilar thing

keen harbor
#

perfect! Hope it works out!