#pablo-escobar-paris_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1275149129470836819
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, so i am using PHP library to implement stripe checkout. I have the following code which is creating the stripe hosted checkout page:
$session = StripeSession::create([
'customer_email' => auth()->user()->email,
'line_items' => [
[
'price_data' => [
'currency' => 'USD',
'product_data' => [
'name' => $payable->title,
'description' => $payable->description,
'images' => [
$content->thumbnail_url,
],
],
'unit_amount' => $payable->price,
],
'quantity' => 1,
],
],
'mode' => 'payment',
'metadata' => [
'order_number' => $order->order_number,
],
'success_url' => route('purchase.success'),
'cancel_url' => route('purchase.cancelled'),
]);
return $session->url;
As you can see I am passing the order number through as Metadata.
But the metadata is missing from the charge.succeeded event
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Metadata does show in the checkout.session.completed event but i need in the charge.succeeded so i can do order fulfillment on my application
You can't propgate the metadata down to the Charge object unless you explicitly update the Charge object. It stays on the Checkout Session object.
The closest thing you could do would be to use payment_intent_data.metadata (https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-payment_intent_data-metadata) to propagate it to the Payment Intent and listen instead for the payment_intent.succeeded webhook event (https://docs.stripe.com/api/events/types#event_types-payment_intent.succeeded)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Do those events: checkout.session.completed or payment_intent.succeeded tell me if the payment was successful and complete? I can use them but need to be sure that payment was completed before any order processign
Yup! Both will tell you that a payment was completed, since Chekout will error on failed payment attempts and prompt the user to try again before ever firing either event
Thanks, and do i need to check any values in those events to check the status or is the event itself is confirmation that payment was completed?
The event itself is confirmation
Perfect thank you boss