Paypal Button - Successful Message

Hello everybody,
I added to my site a Paypal button generated with HTML code obtained directly from their site and it works. However, I need to get an answer in case of a positive outcome to be managed with VELO.

I realized (reading numerous posts here) that I have to use the window.postMessage function and I also managed to write the code that from an HTML widget sends me a response to the VELO code of the page itself and it works.

However, I can’t put this function in the Paypal button code because as soon as I load the page it performs my function without even having made the payment.
I would like to avoid customizing an entire Paypal button just to get a response after the positive transaction.

Could you please help me?
Thank you very much

PAYPAL BUTTON CODE

MY HTML CODE

VELO PAGE
var transaction ;

$w . onReady ( function () {
// when a message is received from the HTML element
$w ( “#html1” ). onMessage (( event ) => {
transaction = event . data
$w ( “#txtAnswer” ). text = transaction ;
nextPage (transaction)

})

Sorry if I renew a request for a solution to the problem, but could someone please give me some indication on a possible solution? Thank you!