Express checkout always returns cancel - sandbox account

LucaIdox
Contributor
Contributor
Hi I have set up a quick test using the following: https://developer.paypal.com/docs/checkout/quick-start/ I use my sandbox client id in my client code. Every time I complete a payment using a test credit card, the response I get in my client code is a "cancel" event (i.e. the onCancel is triggered instead of onAuthorize) Below is the JS snippet: paypal.Button.render({ // Configure environment env: 'sandbox', client: { sandbox: 'MY_SANDBOX_CLIENT_ID', production: 'xxxxxx' }, commit: true, // Customize button (optional) locale: 'en_GB', style: { size: 'small', color: 'gold', shape: 'pill' }, // Set up a payment payment: function (data, actions) { return actions.payment.create({ transactions: [{ amount: { total: '1.00', currency: 'GBP' } }] }); }, // Execute the payment onAuthorize: function (data, actions) { console.log(data); return actions.payment.execute().then(function(payment) { console.log(payment); // Show a confirmation message to the buyer alert('Thank you for your purchase!'); }); }, onCancel: function(data, actions) { alert('cancel'); console.log(data); }, onError: function (err) { // Show an error page here, when an error occurs alert('arror: ' + err); console.log(err); } }, '#paypal-button');
Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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