#Vince

1 messages ยท Page 1 of 1 (latest)

lavish rapidsBOT
muted zenith
#

Hi there

#

Depends on your integration really

#

Are you using Stripe Checkout?

vague rain
#

sry i think i need more context ๐Ÿ˜„

#

yeah. are you the one who helped me earlier?

#

what I want is that I wan to save the record to a table (mysql) and I want 3 data (product price, service fee, and the vat). Some webhooks got identical properties. What do you recommend?

muted zenith
#

Ah yeah we were chatting earlier ๐Ÿ™‚

vague rain
#

i can add it in the metadata property but i need to calculate it.

muted zenith
#

You want to listen for checkout.session.completed

vague rain
muted zenith
#

But yeah you can basically retrieve whatever you need based on checkout.session.completed

vague rain
#

but i want to make sure that the customer's transaction is completed before I insert it in my own table.

muted zenith
#

Yep checkout.session.completed will indicate it has been completed

vague rain
#

i thought i will use the charge.succeeded

muted zenith
#

Yeah I mean you can

#

Either work, just depends on what info you want.

#

But you can get to the Charge from checkout.session.completed, you would just retrieve the Checkout Session and expand the payment_intent.latest_charge

vague rain
#

but in the checkout.session.completed object. what I only see is the vat and the total amount. How can I retrieve the products I bought?

#

I mean I can do a calculation in the backend. but does stripe have it?

muted zenith
vague rain
#

oh okay. I see. thank you. seems i need to do more reading ๐Ÿ˜…

vague rain
#

I dont know if I did it correctly but I am using it in this way

       $line_items = \Stripe\Checkout\Session::retrieve('cs_test_b1bVKFxPQN7iOYRw1bHcgHi10ULHKjSh4KxcMW8t1Ni7NGuSmWRshUfqtl');
       return $line_items;
muted zenith
#

That explains how to use expansion

#

You specifically want: $checkoutSession = \Stripe\Checkout\Session::retrieve([ 'id' => 'cs_test_123', 'expand' => ['line_items'], ]);

vague rain