Mity Docs Mity Docs for Mity Digital
Stripe Checkout Fieldtype Documentation

Using the Checkout Session ID

When you have configured your Stripe Checkout Fieldtype to append Stripe's Checkout Session ID to your Success URL, you will have access to this property as a GET request parameter.

The fieldtype includes two helpers to help you find the Submission based on the Checkout Session ID.

We recommend using getSubmissionFromSession where possible.

getSubmissionFromSession

When the redirect URL is created, this addon stores a refer

This is the preferred way of retrieving the Submission. Because it relies on session storage, only those that have had their redirect generated within the user's session will be available to be returned.

Pass the Form's handle and the Checkout Session ID (from the inbound request), and you can retrieve the Submission (or null if not found).

1use MityDigital\StatamicStripeCheckoutFieldtype\Facades\StripeCheckoutFieldtype;
2 
3$submission = StripeCheckoutFieldtype::getSubmissionFromSession(
4 'my_form_handle',
5 'cs_test_id_from_request'
6);

getSubmissionByCheckoutSessionId

There may be times where you may not be able to rely on the site's session.

Pass the Form's handle and the Checkout Session ID (from the inbound request), and you can look up the Submission (or null if not found).

1use MityDigital\StatamicStripeCheckoutFieldtype\Facades\StripeCheckoutFieldtype;
2 
3$submission = StripeCheckoutFieldtype::getSubmissionByCheckoutSessionId(
4 'my_form_handle',
5 'cs_test_id_from_request'
6);

The getSubmissionFromSession method is the preferred way of retrieving the Session. Using the getSubmissionByCheckoutSessionId method will search through all submissions for the Form, including those that may not have been created by the user.

Remember, it is your responsibility to ensure that the getSubmissionByCheckoutSessionId method is not abused or brute-forced, and that you handle the display of personal information responsibly.