Click here to Skip to main content
14,421,753 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: so much shirt on 't internet Pin
Dave Kreskowiak30-Apr-19 3:51
mveDave Kreskowiak30-Apr-19 3:51 
GeneralRe: so much shirt on 't internet Pin
OriginalGriff30-Apr-19 4:15
communityengineerOriginalGriff30-Apr-19 4:15 
GeneralRe: so much shirt on 't internet Pin
ZurdoDev30-Apr-19 4:35
mveZurdoDev30-Apr-19 4:35 
GeneralRe: so much shirt on 't internet Pin
Marco Bertschi30-Apr-19 5:06
professionalMarco Bertschi30-Apr-19 5:06 
GeneralRe: so much shirt on 't internet Pin
lw@zi 30-Apr-19 5:31
professional lw@zi 30-Apr-19 5:31 
GeneralRe: so much shirt on 't internet Pin
F-ES Sitecore30-Apr-19 6:03
mveF-ES Sitecore30-Apr-19 6:03 
GeneralRe: so much shirt on 't internet Pin
Dr.Walt Fair, PE4-May-19 13:45
subeditorDr.Walt Fair, PE4-May-19 13:45 
GeneralPayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
sandymca9430-Apr-19 1:43
Membersandymca9430-Apr-19 1:43 
Description :

After the button is clicked and the popup finished loading, onCancel is called immediately and overlay disappears but the popup stays open.

I found some link in GitHub - https://github.com/paypal/paypal-checkout-components/issues/750 and already closed, telling us to change our internet/intranet settings and trusted sites. This may work for IE but not for Edge and we can also not tell customers to change settings on their browser before placing an order with us.

Code used (same as https://developer.paypal.com/docs/archive/checkout/how-to/customize-flow/#, only added onCancel and onError):


<pre><meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<script type="text/javascript" src="https://www.paypalobjects.com/api/checkout.js"></script>

 

paypal.Button.render({
//env: 'sandbox', // sandbox | production
env: 'sandbox',
client: {
//sandbox: 'AZDxjDScFpQtjWTOUtWKbyN_bDt4OgqaF4eYXlewfBP4-8aqX3PiV8e1GWU6liB2CUXlkA59kJXE7M6R',
sandbox: '@Model.ConfigData.PaypalClientId',
production: 'xxxxxx'
},
// Specify the style of the button
style: {
//layout: 'vertical', // horizontal | vertical
size: 'responsive', // medium | large | responsive
shape: 'rect', // pill | rect
color: 'blue' // gold | blue | silver | white | black
},

// Show the buyer a 'Pay Now' button in the checkout flow
commit: true,

// payment() is called when the button is clicked
payment: function (data, actions) {
debugger;
// Make a call to the REST api to create the payment
return actions.payment.create({
payment: {
transactions: [
{
amount: { total: '@Model.CreditData.PaymentAmount', currency: 'USD' },
//invoice_number: 'TransactionID',
description: 'Your payment reference number is :' + 'TransactionID',
reference_id: 'InvoiceReference'
}
],
redirect_urls: {
return_url: window.location.protocol.replace(":", "") + "://" + window.location.host.replace("/", "") + '/' + window.location.pathname.replace("/", "") + '?Success=True&RawURL=' + 'returnValue',
cancel_url: window.location.protocol.replace(":", "") + "://" + window.location.host.replace("/", "") + '/' + window.location.pathname.replace("/", "") + '?Success=False'
}
}
});
},

// onAuthorize() is called when the buyer approves the payment
onAuthorize: function (data, actions) {
var return_url = '';
// Make a call to the REST api to execute the payment
actions.payment.execute().then(function () {
//console.log(data);
return_url = data.returnUrl;
});

actions.payment.execute().then(function (res) {
if (res.state === 'approved') {

}
else {

}
}).catch(function (error) {
console.log('onCancel');
console.log(error);
});
},
// Pass a function to be called when the customer cancels the payment
onCancel: function (data, actions) {
console.log('onCancel');
console.log(data);
},
onError: function (error) {
console.log('onError');
console.log(error);
}

}, '#paypal-button-container');

 

 

<div id="paypal-button-container"></div>


Error -
Link - http://i66.tinypic.com/34oyhw6.png[^]
[IMG]http://i66.tinypic.com/34oyhw6.png[/IMG]

modified 30-Apr-19 7:00am.

GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
OriginalGriff30-Apr-19 1:46
communityengineerOriginalGriff30-Apr-19 1:46 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
sandymca9430-Apr-19 20:14
Membersandymca9430-Apr-19 20:14 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
Nand3230-Apr-19 1:47
MemberNand3230-Apr-19 1:47 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
Richard MacCutchan30-Apr-19 1:50
communityengineerRichard MacCutchan30-Apr-19 1:50 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
OriginalGriff30-Apr-19 1:55
communityengineerOriginalGriff30-Apr-19 1:55 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
Richard MacCutchan30-Apr-19 2:13
communityengineerRichard MacCutchan30-Apr-19 2:13 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
OriginalGriff30-Apr-19 2:25
communityengineerOriginalGriff30-Apr-19 2:25 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
Richard MacCutchan30-Apr-19 2:38
communityengineerRichard MacCutchan30-Apr-19 2:38 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
OriginalGriff30-Apr-19 2:52
communityengineerOriginalGriff30-Apr-19 2:52 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
GKP199230-Apr-19 8:15
professionalGKP199230-Apr-19 8:15 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
OriginalGriff30-Apr-19 8:50
communityengineerOriginalGriff30-Apr-19 8:50 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
GKP199230-Apr-19 19:54
professionalGKP199230-Apr-19 19:54 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
Jörgen Andersson30-Apr-19 4:37
communityengineerJörgen Andersson30-Apr-19 4:37 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
Rick York30-Apr-19 10:47
mveRick York30-Apr-19 10:47 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
Richard MacCutchan30-Apr-19 22:56
communityengineerRichard MacCutchan30-Apr-19 22:56 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
lopatir30-Apr-19 1:55
Memberlopatir30-Apr-19 1:55 
GeneralRe: PayPal Checkout.js popup OnCancel event fires automatically in Edge browser Pin
phil.o30-Apr-19 2:18
mvephil.o30-Apr-19 2:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.