Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Form with payment integration

Avatar

Level 3

Hi, 

I need to implement an adaptive form that redirects the user to a payment provider on submit (sending through only a subset of the entered data). Once the user payed, he will be redirected back to AEM. The payment provider will return with either an OK (with additional payment confirmation data) or a NOT OK. Happy path will need to trigger an email with a PDF containing all of the entered fields and redirect to a Thank You Page. Sad path will need to redirect to the same form page with an error message and the previously filled field data. 

Question I have is which is the best way to get all this setup with using the OOTB Forms? Should I create a custom submit action that goes to a custom servlet which will redirect to the payment provider? But since I am redirecting out half way through the form processing, where do I keep all of the entered fields meaning how can I retain the session in order to have the data available for the pdf or the error form page?

Any help is much appreciated. 

Thanks, Alex

1 Accepted Solution

Avatar

Correct answer by
Employee

I think you can save partially filled data as Draft using Adaptive Forms draft feature and do custom submission which does payment gateway integration and signing. Post sign, you can fetch data from draft and remove the draft.

View solution in original post

6 Replies

Avatar

Correct answer by
Employee

I think you can save partially filled data as Draft using Adaptive Forms draft feature and do custom submission which does payment gateway integration and signing. Post sign, you can fetch data from draft and remove the draft.

Avatar

Level 7

I am also facing this issue and as Deepak says, you would need to ensure that you save a Draft just before you call the submit handler to do all the Payment Gateway re-directions. That way you should be able to load up the last draft saved data and re-open the form.

The new problem is: that will get the existing data showing, but how do you inform the re-opened draft that the Payment Gateway submission failed?

Avatar

Level 2

We are currently implementing Payment integration. We save a Draft, then call our Payment servlet that does all the Payment Gateway re-directions. When the payment is successful, we want our servlet to now Submit the form (i.e. remove draft, add submitted). How do we achieve this?

Avatar

Level 1

Hi Moris,

There are 2 ways to achieve this:

1. You can submit from client via guideBridge submit API. This would take care of removing draft and adding a submission itself.

2. To do this from your servlet, there is no clear-cut existing solution but is achievable, but first you'd need to know which submit action you'd want to use as per your requirements. To delete a draft, you'd need to invoke Forms Portal Draft Services which take care of draft persistence logic, in a similar manner you can create submissions using Forms Portal Submission services.

Please let me know your requirements, so that it can be worked upon accordingly.

Avatar

Level 2

Hi Arvind

We are using Forms Portal Submit action.
We have integrated Drafts/Submission with MySQL as per https://helpx.adobe.com/aem-forms/6-1/integrate-draft-submission-database.html

We want to submit the form from our servlet, when payment is successful. So as you stated, delete draft and create submission.
We understand your suggestion to use the Forms Portal Draft and Submission Services, and believe that SubmitMetadataService.saveMetadata(Map<String, Object> metadataMap) is what we need for form submission. Am I correct? And if so, then how do we build the "metadataMap" ?