How can I make sure that after payment, the data from the two pages specified by the user is sent to an external server in the form of json?

What is my block.
I have a digital product, I need a window to open when I click on it, where I can select the quantity of the product, choose the type (for a gift, for myself or for a corporate purchase), and when the user selects the type, the input fields (first name, last name, email) drop down. And then there is a pay button.

When he goes to the checkout page, he fills in the data and when he pays, the data from these two pages should be collected in a json file and sent to the server.

What exactly is my problem.
I wanted to know how I can add such custom inputs and then how to collect them all in one json file and send them?

I’m using stripe payment and the make automator.

Can you please help me?

I see what you wanna do. To achieve your goal, you’ll need to follow a few steps. Firstly, ensure that your input fields for quantity, type, and user details are properly set up. You can use HTML forms for this purpose.

Since you’re using Stripe for payment, you should handle the form submission using JavaScript. When the user clicks the pay button, gather all the input data from both the product selection and checkout pages. You can use JavaScript to create a JSON object containing all this data.

Next, you’ll need to send this JSON data to your server. I think you can do this using an AJAX request, typically with fetch or XMLHttpRequest. This request would be triggered after the payment is successful. Make sure to handle this on the server-side, likely in your ‘success’ webhook from Stripe, to ensure the payment is confirmed before processing the data.

Lastly, since you’re using the Make automator, you might want to set up a webhook in Make that listens for incoming data from your server. This way, you can automate further actions based on the received data.

Hope this helps! Cheers

That is, I need to make one page where I need forms and my checkout page, make my forms on both of these pages and write js code that will generate a json file and send them to an external server if the payment was successful from the stripe?

If so, can you tell me how to make sure that this data is sent to the server only after the payment is made via stripe?

Exactly, you’ve got the right idea, Vlad. Here’s a bit more detail: Yes, create forms on your product selection and checkout pages. Make sure these forms capture all the necessary data.

Then write JavaScript code to compile the data from these forms into a JSON file.

Ans then, to ensure the data is sent after successful Stripe payment, you’ll want to integrate your JavaScript code with Stripe’s payment confirmation process. Use Stripe’s payment success callback function to trigger the sending of your JSON data to the server.

Remember, handling payment data securely is crucial, so ensure that your implementation complies with all relevant security standards, including Stripe’s.