Hi everyone,
I'm just after some advice, and hopefully reassurance, before I start trying to build something.
My quick question: Can you integrate data from a REST resource asset into an eCommerce form, and then take responses from a completed payment process and send them back via a REST call?
The full story:
We have a database full of items out in the National Park that need replacing; signposts, gates, bridges etc. And we're going to be offering people the chance to donate or 'buy' these items (people love buying a bench as a memorial for a loved one, this is a continuation of that). The database does a whole lot of other things for the ranger teams, so rather than re-creating that data in Matrix as product assets, we'd like to create an API and have Matrix call the API to get details of the items. Those details, including cost, need to be integrated into an eCommerce form, that will allow users to enter their details and then pay (via a SagePay payment gateway).
Is that possible?
I'm envisaging that I'll have to create the form questions as normal, view the output, copy the html, paste that html into the form bodycopy and then 'edit' it to include the data that is coming from my API call.
Would you recommend one API call and use the js pre-processor to wrap it in the right tags, or have seperate API calls just for the bits of data that are needed, and place those into the form elements?
I've hacked forms a bit like this before, but will the values from the API calls get carried across into the form payment process?
There will also be some 'normal' ecommerce form questions (user contact and address details).
And then lastly, once the payment process is completed, I'll need to make an API call back, and pass it a bunch of values about the order, some about the item and some that the user entered in the normal fields. As well as send the usual 'thankyou' email back to the user with details about their transaction.
Is that going to work?
Will I be able to make a call back - the only 'submission action' on an eCommerce form seems to be 'Make a SOAP' form - whereas a custom form has 'Call REST resource'.. so can an Ecommerce form make a call back to an API to update the database to show the item has been bought?
Any advice really appreciated!
Thanks,
Charlie.