I do not use Webhook or IPN, both were a PAIN. Here the solution that I used: // Render the PayPal button into #paypal-button-container // by David . Nugent - Using PayPal REST V2 API Last update: 05/27/2020 paypal.Buttons({ style: { layout: 'horizontal', color: 'gold', shape: 'pill', label: 'checkout', size: 'responsive', tagline: 'true', }, // Set up the transaction createOrder: function(data, actions) { $('#paypalmsg').hide(); $('#transmsg').show(); $('#transmsg').html('<b>'+'WAITING ON AUTHORIZATION...'+'</b>'); $('#chkoutmsg').hide() return actions.order.create({ purchase_units: [{ description: 'GnG Order', amount: { value: cartTotal } }], application_context: { shipping_preference: 'NO_SHIPPING' } }); }, // Finalize the transaction onApprove: function(data, actions) { return actions.order.capture().then(function(details) { // Show a success message to the buyer $('#transmsg').html('<b>' + 'AUTHORIZED...' + '</b>'); $('#transmsg').append('<br>'+'Transaction completed by: ' + details.payer.name.given_name +' '+ details.payer.name.surname + '<br>' + "Order Id: " + details.id + '<br>' + 'Status: PAID & APPROVED' + '<br>'+ 'Thank You For Your Order'+ '<br>'); if (details.status === "COMPLETED") { window.setTimeout(function() {}, 500) $('#transmsg').append('<b>' + 'Sending Order...Please Wait' + '</b>'+'<br>'); $('#transid').val(details.id); $('#orderstat').val('APPROVED'); $('#orderform').submit(); <------Here is where I call the submit for the email form for the merchant Here is my HTML in the form (<form id="orderform" data-form-type="order" data-result-class="rd-mailform-validate" method="post" action="bat/rd- mailform.php" class="rd-mailform offset-md-top-80 offset-top-30 z-index"> if you need the Jquery portion of that segment let me know) } }); if (details.error === 'INSTRUMENT_DECLINED') { $('#transmsg').html('<b>' + 'TRANSACTION WAS DECLINED'+'</b>'); $('#transmsg').fadeIn('slow').delay(3000).fadeOut('slow', function() { $('#paypalmsg').show(); $('#chkoutmsg').show(); $('#transmsg').empty(); }); return actions.restart(); }; }, onCancel: function(data) { $('#transmsg').html('<b>' + 'YOUR TRANSACTION WAS CANCELLED' + '</b>'); $('#transmsg').fadeIn('slow').delay(3000).fadeOut('slow', function() { $('#paypalmsg').show(); $('#chkoutmsg').show(); $('#transmsg').empty(); }); } }).render('#paypal-button-container');
... View more