HTML button returns a payload that I need to save in the Database

I have a payment button created in HTML from the payment processor.

Upon payment completion, the payment processor returns a payload that looks like this:

I need to save the response in my database, how do I go about it?
I need this to confirm whether the payment was successful or not and compare the amount paid by the user to the invoice amount.

Here it the HTML button, for reference: