#Niklas-subscription-typescript
1 messages ยท Page 1 of 1 (latest)
Hey there ๐ I see you referenced stripe-js, does this mean you're working on front-end coding?
Mainly front-end, yes ๐ . But I poke around in the back-end for this project as well.
And which section are you working on when you hit this typescript error? Trying to confirm whether we should be looking at the stripe-js or the stripe-node library.
This is an error encountered in the front-end, if that is what you mean with section.
In more detail, this is the object that is throwing the error:
And this is, part, of the response object, which contains and shows the plan-property and it's existence in the response
Taking a closer look
Thanks!
And which API version are you using to retrieve the subscription object?
I'm getting the same response with 2020-08-27 and 2019-03-14
Can you copy/paste that sub_1JZ... ID here?
Apologies for the delay, still digging.
No worries, thanks for the digging and the assistance!
Hey there, taking over here
Hello!
Can you explain the context for trying to use this like this via Stripe.js? This would normally be data you access via your server using the back-end stripe-node client, and return to your client app using your own data structures
I've not been with this project from the start, but the general idea is that we need this data in the frontend to perform actions on it. And we want to access your data structures where we actually have typescript (we are running laravel without typing checks in the backend) to make sure we aren't trying to access properties that's been changed or deprecated.
We've recently rebuilt the frontend using typescript and that is why we are now discovering this inconsistency in the api-response vs the expected stripe-typing.
@civic sun Which type definitions are you using?
Hello,
The two stripe-packages we have in the project are:
"@stripe/stripe-js": "^1.21.1"
"stripe": "^8.189.0"
From them we get the types we are using.
The stripe package is for server-side use, while Stripe.js is for client-side use. They should not be used at the time time like that.
If this is client-side code it should not be loading stripe
We are using server-side-rendering of most components in the front-end, that's why we are importing the stripe-package as well. But thank you for the information ๐
Regardless, there is still an issue with the expected type and the actual response - is it not?
I have to leave work for now, but I ask you kindly to leave this thread open so that we can continue the discussion.