dtostes
dtostes

Reputation: 113

Redirect to a page after Paypal transaction

I did the example explained at:

https://developer.paypal.com/docs/checkout/integrate/#2-add-the-paypal-javascript-sdk-to-your-web-page

<script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      // This function sets up the details of the transaction, including the amount and line item details.
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '1.00'
          }
        }]
      });
    },

    onApprove: function(data, actions) {
      // This function captures the funds from the transaction.
      //actions.redirect();

      return actions.order.capture().then(function(details) {
        // This function shows a transaction success message to your buyer.

      });
    }




  }).render('#paypal-button-container');
  //This function displays Smart Payment Buttons on your web page.
</script>

But i want to send the user to other page after the transaction is approved.

i try to use:

onApprove: function(data, actions) {
      // This function captures the funds from the transaction.


      return actions.order.capture().then(function(details) {
        // This function shows a transaction success message to your buyer.
        actions.redirect("<url>");
      });
    }

Without success.

Any idea about how to set the redirection url?

Upvotes: 2

Views: 1348

Answers (1)

CThomas
CThomas

Reputation: 71

Have you tried using this?

document.location.href = "www.your-redirect-page.com"

Upvotes: 3

Related Questions