cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

SmartButtons Return URL's not working

johmarjac
Contributor
Contributor

Hi,

 

I am currently trying to get Smart Payment Buttons working.

I was following the documentations integration guide. This is my code so far:

 

<!DOCTYPE html>
<html>
	
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	</head>

	<body>
		<h1>PayPal Smart Button Test</h1>
	
		<div id="paypal-button-container"></div>
	
		<script src="https://www.paypal.com/sdk/js?client-id=myclientid&currency=USD&disable-funding=credit,card,sepa"></script>
		
		<script>
			  paypal.Buttons({
				createOrder: function(data, actions) {
				  return actions.order.create({
					purchase_units: [{
					  amount: {
						value: '0.01'
					  }
					}],
					return_urls: {
						return_url: 'https://www.google.de/',
						cancel_url: 'https://www.youtube.de/'
					}
				  });
				},
				onApprove: function(data, actions) {
				  // Capture the funds from the transaction
				  return actions.order.capture().then(function(details) {
					// Show a success message to your buyer
					alert('Transaction completed by ' + details.payer.name.given_name);
				  });
				}
			  }).render('#paypal-button-container');
		</script>
	</body>
</html>

This renders the button, and I can do the sandbox payment. But neither of the both return url's provided work. It doesnt return to the cancel url when canceling the order, nor does it return to the success url when the payment is completed. I also cannot find any documentation to this.

Why isnt that working properly? Do I have to setup more settings? What am I doing wrong?

 

Thanks

Login to Me Too
Who Me Too'd this topic