Setting up Express Checkout with Return URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am unsure of how to set up express checkout with the return url. I just want to redirect to a page after the customer pays. I am able to do this with a simple button that redirects to paypal --I can just set autoreturn in paypal. However when using the express checkout code with the pop up nothing happens after the payment.
In the docs it mentions getting the dg.js script from paypal but does not give a link to this file. Do I need to pay for this?
Is there a way to simply have the buyer go to a page after they pay, using the express checkout overlay box? Here is my code:
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
<script>
paypal.Button.render({
env: 'production', // Or 'sandbox'
client: {
sandbox: 'xxxxx',
production: 'xxxxx'
},
commit: true, // Show a 'Pay Now' button
payment: function(data, actions) {
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '0.01', currency: 'USD' }
}
]
},
experience: {
input_fields: {
no_shipping: 1
}
},
redirect_urls: { return_url: 'https:pacinst.org/wordwater.org/thank-you'}
});
},
onAuthorize: function(data, actions) {
// Get the payment details
return actions.payment.get().then(function(paymentDetails) {
// Show a confirmation using the details from paymentDetails
// Then listen for a click on your confirm button
document.querySelector('#confirm-button')
.addEventListener('click', function() {
// Execute the payment
return actions.payment.execute().then(function() {
// Show a success page to the buyer
});
});
});
if (error === 'INSTRUMENT_DECLINED') {
actions.restart();
}
}
}, '#paypal-button');
</script>
<div class="page-content">
<?php the_content(); ?>
<?php cpotheme_post_pagination(); ?>
</div>
<div id="paypal-button"></div>

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Missing products from transaction, order's products not tally with ecommerce website and paypal in About Payments
- shopify in Selling on your website
- PayPal Sandbox testing authorisation without logging in in About Payments
- Turning off 'PayPal Account Optional' not working in About Settings
- Problems with client-side PayPal Express Checkout implementation in About Business