1

I have set the success URL in the one time and subscription payments in Paypal account. Now I would like to know how to set the cancel URL? Here is the code I used:

   onApprove: function(data, actions) {
      return actions.order.capture().then(function(orderData) {
        

        // Or go to another URL:
        window.location.href = 'https://crewbidapp.com';
      });
    },

1 Answers1

0

Use the onCancel callback function as documented in the JavaScript SDK Reference

Absolutely no business nor fulfillment logic should (exclusively) rely on the user being directed to one of these URLs. They may never load it, for any number of reasons, and even if they do you need to validate that a subscription actually took place.

To be notified directly of successful payments on a subscription, subscribe to the webhook event PAYMENT.SALE.COMPLETED. This is essentially required if anything automated is to happen, and the only notification that can be exclusively relied on.


For an advanced combination of both push and pull notification, see this answer.

Preston PHX
  • 27,642
  • 4
  • 24
  • 44