Using stripe's API and the Integration Builder, before you go to the checkout page, you can get the id
of the Ceckout Sessions
in the create-checkout-session.php
file. (
CodePudding user response:
To be clear,
- You can retrieve the full details of a Checkout Session any time using the API : https://stripe.com/docs/api/checkout/sessions/retrieve. There is no "expiry" for this.
- You can only access the full data of an Event e.g.
checkout.session.completed
if it was created within the last 13 months from the Dashboard. Events older than 30 days will only provide a summary view. Events within the last 30 days will be fully visible via the API and Dashboard. (source) - A Checkout Session expires 24 hours after they’re created (i.e. the customer cannot access/pay via the Checkout url), but you can shorten the expiration time by setting
expires_at
(source). Note that you can still access the details of the Checkout Session as mentioned in the first point.
Ideally, you should rely on webhooks :
The checkout.session.completed
event will contain the customer and subscription.