Smart Payment Buttons - How to set return url

Imengine
Contributor
Contributor

Hi All,

is there a way to set a return url with Smart Payment Buttons?

It's really unclear for the user that the thank you page is the same of the order page.

 

Thank you,

Luca

Login to Me Too
3 REPLIES 3

Gabriel_PP
Moderator
Moderator

Hi @Imengine 

 

Thanks for reaching out to us,

 

Here, you can find an example of how to do this on Smart Buttons.

 

There is an object called: redirect_urls 

 

   return actions.payment.create({
       payment: {
               transactions: [{
                  amount: {
                         total: '0.01',
                        currency: 'USD'
                              }
                  }],
                            redirect_urls: {
                                   return_url: 'https://example.com',
                                   cancel_url: 'https://example.com'
                              }
                  }
         });
       },

 

You could also set up a "cancel" URL.

 

I hope this helps,

Thanks,

Login to Me Too

Imengine
Contributor
Contributor

Thank you.

It works also with Subscriptions?

 

This is my script

 

<script>
paypal.Buttons({
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': '<?=$paypal_plan_id;?>'
});
},
onApprove: function(data, actions) {}
}).render('#paypal-button-container');
</script>

 

Best,

Luca

Login to Me Too

peepz
New Community Member

Hi,

Did you get this to work? I am also looking for this solution with Smart Buttons and Subscriptions. I can't find any info on how to do this!

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.