#JCoDog - Webhook
1 messages ยท Page 1 of 1 (latest)
HI ๐
What is the event you are receiving and what about it isn't what you expect?
Turned out I was usinglive endpoint secret an key instead of test so it wasnt retrieving the checkout session or items
Okay yep, that'll do it
Yes, all working now. Thanks
I am however concerned that it isnt showing the price that the user paid in the database where I record payments
item->price->unit_amount
cs_test_a1krVr1qrhsE8A0Vpg9nMouLO6pUGOhNVZQyeIg2GKjQq5uOkZeeEcA5ly
Event ids start with evt_
evt_1LLqsMEOJsqRXL0RN329K9zU
Okay so we've got an amount_total of $5.00. Is tha tnot what you expect?
I'm not sure what "item->price->unit_amount" is in reference to. What do you mean here?
it wass for a quantity amount pricing product
The price you specified for the checkout session is price_1LLqbDEOJsqRXL0RAya5ATgm
That price has the custom_unit_amount feature enabled
This means a user can pay what they want
The default is set to 5.00 GBP
But it could be any value between 1 GBP and 500 GBP
You can expand the Payment Intent that is returned with the Checkout Session in the checkout.session.completed event
I do
So make a GET request for Payment Intent by that ID
That is not the payment intent. those are line items
Yes, thats how you get the price they pay yes?
Nope
Get the Payment Intent and the amount from that
A Payment Intent with status succeeded and an amount means the customer paid the amount in the Payment Intent
It depends on when you see it. Because the price has a preset amount, then the Checkout session is created with that amount but it might not be what the customer ends up paying (because they can change it)
I still don't see any reference to the payment intent there
So I would need to expand the payment intents and pull the amount from that?
Yes, that will give you the full amount the customer paid
Yes, you can just add 'payment_intent' to the expand array when retrieving the Checkout Session
You shouldn't need the data bit, since there's only one payment intent. The data property is Stripe convention for lists of objects.
it didnt store in the database
Okay, can you log the itent object?