Stripe recently released a nice feature where you can embed checkout sessions into your page:
I have two Stripe plugins that are built on Checkout and I’d like to add this feature to them.
It should be fairly straightforward. The user of my plugins will:
- Create a Checkout Session on one page
- Navigate to another page where they will add a Checkout Session element
- Run a workflow action on page load that embeds the Checkout Session on the Checkout Session element
It’s step #3 I’m struggling with. I can’t figure out how to securely access the ‘clientSecret’ value that is associated with each Stripe Checkout Session on page load. This is required to embed the Checkout Session.
You can get the clientSecret from the Stripe Checkout Session object, but I can’t figure out how to dynamically retrieve the Checkout Session details and then use the returned clientSecret value in this action.
Any help would be greatly appreciated!