#rzahng-Webhook
1 messages · Page 1 of 1 (latest)
Hi there, Checkout Session will implicitly create a PaymentIntent under the hood. Therefore when a checkout session using a delayed payment method finally succeeds, both checkout.session.async_payment_succeeded and payment_intent.succeeded are fired.
cool! Also say the user used credit card to pay. Since credit card is instant, will it still fire checkout.session.completed and checkout.session.async_payment_succeeded in that order?
it will fire checkout.session.completed and payment_intent.succeeded. It won't fire checkout.session.async_payment_succeeded because credit card is not a delayed payment method.
In addition, Stripe does not guarantee delivery of events in the order in which they are generated. see https://stripe.com/docs/webhooks/best-practices#event-ordering
i see, since paymentintent has sort of all the events that checkout.session has, do u recommend that I just catch payment intent events?
It really depends on your business. If you only care about the payment result then you can just listen to payment_intent related webhook events.
is there a payment intent equivalent of checkout.session.completed?
checkout.session.completed means the checkout session is completed. However it doesn't always guarantee that the payment is succeeded. For immediate payment method (i.e., card) the payment is succeeded when the checkout session is completed, but for delayed payment method, the payment is still pending when checkout session is completed .
payment_intent.succeeded means the payment is succeeded regardless of the payment method type.
gotcha, thanks! When we create a session or a payment intent, how do we identify the buyer who is purchasing the items?
You can pass in a customer param to associate this checkout session.
ok i see thanks, so we are trying to make a marketplace that enables buyer initiated offers, meaning the buyer has the ability to set a price for the seller, and seller can choose which offer to pick. Does paymentIntent work for this use case? I just dont know how can a buyer input their payment information where it will not be processed until the supplier accepts the offer
You can use setup mode Checkout Session to collect the payment details from customers without charging them.
Once the supplier has accepted the offer, you can use PaymentIntent API to perform an off_session charge.
Also you might be interested in Stripe Connect, so that you can register your suppliers as connected accounts and manage the payouts.
yes we plan to give sellers connect accounts, but where can ifind the setup mode?
https://www.youtube.com/watch?v=S1WJuhGkY88 this video will be helpful
Learn how to collect payment details using Checkout's setup mode, which stores the payment method on file for future payments using the Setup Intents API.
Presenter
CJ Avilla - Developer Advocate at Stripe - https://twitter.com/cjav_dev
Table of contents
00:00 Introduction
00:36 Add a checkout button
00:42 Add an endpoint to your serv...
gotcha thanks!
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-mode and here is the API reference
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
how does checkout session work for setup? Once we execute stripe.checkout.sessions.create, does it redirect user to a url to enter payment information? Once user enters info, does it fire checkout.session.completed?
Also, whats the paymentIntent API to execute an off_session charge?
Yes, you will get notified with checkout.session.completed.
To create an off_session charge, set off_settion=true when creating the payment intent https://stripe.com/docs/api/payment_intents/create#create_payment_intent-off_session
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
how do we link the setupIntent with the paymentIntent when creating paymentIntent?
You should get the payment_method from the setupIntent and use it to create the paymentIntent
i see thanks, and when we create a session, it does not create a payment intent?
it depends on the checkout session mode, if it's setup, a SetupIntent will be created under the hood
i see thanks! One more thing: I read this under sessions object: "For Checkout Sessions in payment or subscription mode, Checkout will create a new customer object based on information provided during the payment flow". How can we create a customer object for setup mode?
You need to create a customer first and pass the customer to the checkout session creation API call.