Passing data from front end to server side

Hi all!

I’m building a plugin, and I’m wondering, what are the ways to pass data from a client-side element to a server side action? Can I do it through exposed states? Or is there a better way? Thank you in advance.

Daniel

Can you explain more what you are trying todo?

Hi Jici,

The plugin integrates Stripe payments.

The Initialize function in the Element checks the available payments, and fetches a paymentMethod JSON object. I am able to retrieve the paymentMethod Id from this object, and I want to pass this Id to the server side action, so that it can confirm a paymentIntent straight away.

Not sure what you are doing is secure…

However, if you want to pass a value from element plugin, you need to store this value into a state. Create a server side action with a field and in your workflow, use the state value of the element to send it to the server side action.

That sound also complicated for something that could be done, mostly, with API Connector and backend WF (webhooks)

1 Like