#nate!
1 messages · Page 1 of 1 (latest)
Hello, what's up?
You can't get the quantity in the Event, but you can get the ID of the Checkout Session from the Event and then fetch the Checkout Session with line_items expanded, and each of those line items will have a quantity: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
It will be in the response when you retrieve the Checkout Session with line_items expanded.
See here for details on expansion: https://stripe.com/docs/api/expanding_objects
That's code to retrieve a Charge, you need to retrieve the Checkout Session.
That code, but with line_items expanded.
@upper gust
Can you give me the request ID for that request? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
The request ID will start with req_.
Thanks! Looking...
It looks like you tried to retrieve a Charge, not a Checkout Session.
You need to change your code to retrieve a Checkout Session, not a Charge.
There is no stripe.checkout.retrieve
Have a look at the example code here: https://stripe.com/docs/api/checkout/sessions/retrieve
i don't see no amounts in line_items
What do you see?
can i ask a non stripe related question
Sure, but I don't know if I'll be able to answer it.
let newKey = uuidv4();
so i have this module called uuid
i need to generate uuids that at amount of user e bought
Not sure I understand. A UUID is a universally unique ID that isn't based on anything. Can you provide more detail?
when u run uuidv4(); function
it returns 1 uuid
i need to generate the same amount that user bought
i was thinking something like
let number = 0;
let keys: Array<string> = [];
while(0 > 14) {
keys.push(uuidv4())
}
That won't work, because 0 will never be greater than 14. You need a for loop where you count through the quantity.
can you write me that code
Something like for (i=1, i<=quantity, i++) {}
That's not tested, but something like that.
But I can't really write your code for you beyond a simple example like that.
I don't think that will work. The loop, if it starts, will go on forever because you're incrementing number and the while condition is checking to make sure number is greater than the other thing.