When your customer successfully completes their payment using Checkout,
Stripe redirects them to the destination that you specified in the
success_url parameter. Typically, it’s a page on your website that informs
your customer that their payment was successful.
Fulfilling purchases with the Dashboard
When the user successfully completes payment, it is recorded as a new entry in the Dashboard’s list of payments. When you click an entry in the list, it takes you to the payment detail page. In the Checkout summary section, you can find the customer’s billing information and the list of items that they purchased. You can use this information to manually fulfill the customer’s purchase.
Dashboard fulfillment is only practical for digital goods that you can send to the customer via e-mail. If you intend to fulfill purchases that include physical goods, your application should collect shipping details.
Fulfilling purchases with webhooks
Stripe can send webhook events to your server to notify you when a customer completes their payment. You can create a handler for the event and use it to execute any code that you need to fulfill the customer’s purchase. To handle a webhook event, create an HTTP endpoint on your server and configure the webhook endpoint in the Dashboard.
Stripe sends the
checkout.session.completed event when a Checkout
payment is successful. The webhook payload includes an array of SKUs or plans
purchased by the customer, the ID
of the PaymentIntent created by Checkout, and optionally
clientReferenceId if it was provided in the
redirectToCheckout call. The
clientReferenceId is used to associate the successful payment with an purchase.
The following example demonstrates how to create a webhook event handler that prints
the SKU for each item purchased:
require "json" require "sinatra" post '/' do event = JSON.parse(request.body.read) if event['type'] == 'checkout.session.completed' for item in event['data']['object']['display_items'] client_reference_id = event['data']['object']['client_reference_id'] # Fulfill the purchase using the client_reference_id... end end status 200 end
This following table documents the keys and values present in the
|The ID of the created subscription if a plan was used.|
|The ID of the confirmed PaymentIntent used for the customer's payment.|
An array of objects representing the items that your customer purchased.
|The URL Stripe redirected your customer to after they completed the payment.|
|The URL Stripe redirected your customer when payment was canceled.|
|A unique string to reference the Checkout session. This can be a customer ID, a cart ID, or similar. This can be used to fulfill the purchase.|
|A boolean representing whether the live mode or test mode key was used.|
You can obtain the customer’s e-mail address and billing information by
payment_intent property of the webhook payload and
inspecting the PaymentIntent’s