-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
id
is a string and not a number
#3
Comments
@phiilu yes, that's weird indeed, but it's how LemonSqueezy returns these IDs 🤷 I find it interesting that What happens if you send e.g. a Maybe we should raise this with LemonSqueezy? |
I requested that they unify the types of IDs in LemonSqueezy's Feature Request page. I can't link to the request directly but if you search for |
Thanks for reporting this to the Lemon Squeezy Team! I upvoted it 😄 And yes, you are totally right the API is returning indeed a string for the This makes it quite annoying to work with the results. As you already mentioned the I hope they change it or give a good reason why this is the case ^^ |
What do you think, would it make it easier to use the library if we’d sanitize this in our responses? So, to convert all integer IDs to string IDs when building the response struct? We can always remove it once they fix it on their end.
…On 15. Apr 2023 at 09:21 +0200, Florian Kapfenberger ***@***.***>, wrote:
Thanks for reporting this to the Lemon Squeezy Team! I upvoted it 😄
And yes, you are totally right the API is returning indeed a string for the id 😅 I did not consider this 🙈
This makes it quite annoying to work with the results. As you already mentioned the product.id is a string and variant.product_id is a number and those can't be compared with ==
I hope they change it or give a good reason why this is the case ^^
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
I do not really have a definitive answer 😅 I think this could be a convenient solution, but I am not so sure if it is a good idea to change the types of API responses. Maybe this can cause confusion (?) On the other side casting all So with that said I would be fine with both approaches:
If you find one or the other solution better, then you can decide what makes the most sense to you 😄 |
@phiilu sorry for getting back to you so late, but I agreed with you and saw no need for further action. I'm reluctant to change the API response to anything that isn't defined in the docs. Otherwise, folks might get confused why the doc say one thing and the code returns another thing. I submitted the feature request there, so let's see. Maybe they fix it. Maybe they don't. |
I noticed that the
id
field of a Variant or Product is a string and not a number, while all other ids (store_id
,product_id
) are numbers.Going through the code I did not see why this is the case.
The text was updated successfully, but these errors were encountered: