#sejo
1 messages ยท Page 1 of 1 (latest)
Hello what is your subscription problem?
hi
I am creating the code that the documentation gives me on the side of the node.js backend but it gives me an error, I don't know why
It asks me for other items in lines_items but if the code is passing it to me, stripe should only pass the priceId
Can you send me the code for the API call that you are making and the exact text of the error that you are getting back?
The currency was not there but as he asked me, I just put it in, but I already got more errors, that's why I entered here
?
Ah, you are using the parameters from an older API version
One sec, we have the new ones documented somewhere
Here is the doc on them being removed https://stripe.com/docs/upgrades#2022-08-01:~:text=The following parameters,line_items[images]
So what happens if you remove currency? Do you get a different error?
if you ask me to put it... it is supposed that with the priceId you should already identify the subscription of the web
then I would not be making a subscription and I would be making a normal purchase if I have to pass all the parameters
Hello ๐
Taking over as Pompey needs to step away soon
The code you're currently using is for an older API version than what your account currently uses
I'd recommend reading through this doc as it provides step by step instructions on how to create a subscription integration using Checkout
https://stripe.com/docs/billing/subscriptions/build-subscriptions
is seriously ? at least you saw my code
? I mean, it's the same one that's there hahahahaha I said to copy the code from there
The screenshot has a different code than what your server is running
You don't have line_items.amount in the code that you shared but we do see the error referencing it
So you are running a diff code than the one you're looking at
This is from the link you gave me... where is what you told me about lines_items.amouunt?
Look at the error message
The only difference between that code and mine is that I put the success or cancel routes
nope, I'd highly recommend checking if your server is running the correct code
I mean, even though it's a subscription, do I have to detail the product? I don't understand what the priceId they give you when you create the product is for
A user will subscribe to a recurring product when you create a subscription so yes, you'd need to pass in the information about what the user is subscribing to by passing in the product ID
which I am trying to subscribe to is a recurring product
It's not the code that you're writing is throwing the error.
It's the code that you're running on your server. You're likely running a diff code than what you're looking at.
The error message is super clear about what parameters are unexpected which you clearly don't have in your code shared in the screenshot
ahhh of course, I understand even though it is a subscription, I still have to pass the product information with the id... because the id does not identify the recurring product
No you don't pass it when you create a checkout session.
You pass it when you create the product initially
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=checkout#create-pricing-model
I just copied the code that doesn't matter to me, it doesn't fire and it gives me the same error
I send the priceId from the front, it is the same code now and it gives me the same error
That's because as I mentioned earlier you're running a completely diff code on your server versus what you're writing.
If you comment out the whole code, you'd still see the same error
But it is the code that the stripe website gives me for node.js, what other code do you want me to put? I don't understand why you only tell me that my code is wrong but what code should I put if that gives me stripe for node.js
I am not telling you the code is wrong, I am telling you that your server is running a different code altogether.
I'm following the steps on the website hahaha I don't think you even know what's going on because it's weird
I don't think you understand what code your server is running.
Have you tried restarting the server?
Thanks anyway, it will be looking for another payment gateway, thank you very much for your time
๐ hello there
Can you copy/paste the request ID (req_xxx) that is in your error above @wooden sigil ?
this?
Yeah can you just grab that for me?
And can you run another quick test and comment out the Checkout Session creation altogether and just put a log in its place
Like console.log("within Checkout Session creation route");
Great!
Okay can you comment the above back in and run another test?
And then provide the error if there is one
And the request ID if there is one
Interesting! Can you copy paste that request ID so I don't have to type it out?
Thanks. Give me a moment to look
ok
Okay interesting. So if you look at that request in your Dashboard (https://dashboard.stripe.com/test/logs/req_lmojNTIKj82URM) it looks like your price parameter isn't coming through at all.
Can you log out your price variable before the Checkout Session?
Looks like it is actually priceId
I use this product id
Yep that's the right one to use
Have you tried hard coding it?
Or making sure that your variable is initialized correctly?
I have it on the front through a request to my node.js server, it sends me the id of the product that you saw when you made me comment on everything
Sure but it isn't coming through in the API request for some reason. So we need to figure out why that is. Can you test hard coding it in your code instead of using a variable just to make sure that works as expected?
Okay so I can see successful Checkout Session creations on your account now so I do think we narrowed it down to involving that priceId variable
So I'd recommend logging out that variable on your server right before your checkout.sessions.create() function runs
ok
I think that with this it works, it even points to where the subscription is created. I already have created the webhooks. Anything, I'll contact you again
Sounds good! Glad you got it working!