Hello, I wonder if anyone can shed some light on this: 1. I am implementing PayPal Express Checkout on our site 2. I have the credentials and I've implemented the button that brings up the PayPal payment pop-up on our site. 3. I am using the 'Server-Side REST' example 4. I'm able to call a script on my server which uses the PayPal SDK to create a payment and the paymentID gets returned correctly to the 'button' script. 5. But after the button opens the pop-up, all I receive is '"Things don't appear to be working at the moment."'. No error message, nothing. This is the part of the code that obtains the paymentID from my server: // Show the buyer a 'Pay Now' button in the checkout flow
commit: true,
// payment() is called when the button is clicked
payment: function() {
var data = {
"orderId": <%= CurrentOrder.O_Id %>
}
// Set up a url on your server to create the payment
var CREATE_URL = '/ShopCart/ShopCart.aspx/PayPalExpressCheckoutPaymentCreate';
// Make a call to your server to set up the payment
return paypal.request({
method: 'post',
url: CREATE_URL,
json: { "orderId" : <%= CurrentOrder.O_Id %> }
}).then(function (res) {
console.log(res.d);
return res.d;
});
}, This WORKS CORRECTLY, the paymentID is returned correctly. However, this next bit of code never gets accessed (it includes another URL to a script that records the payment successfully on my server): // onAuthorize() is called when the buyer approves the payment
onAuthorize: function(data, actions) {
// Set up a url on your server to execute the payment
var EXECUTE_URL = '/ShopCart/ShopCart.aspx/PayPalExpressCheckoutPaymentExecute';
console.log(EXECUTE_URL);
console.log('paymentID: ' + data.paymentID);
console.log('payerID: ' + data.payerID);
// Set up the data you need to pass to your server
var data = {
paymentID: data.paymentID,
payerID: data.payerID
};
// Make a call to your server to execute the payment
return paypal.request.post(EXECUTE_URL, data)
.then(function (res) {
console.log(res);
window.alert('Payment Complete!');
});
} This doesn't work and the pop-up remains open with the error message that things aren't working at the moment. Anyone have any clue? Since the JavaScript opens and is able to call the first script, I don't think this should be a problem of my 'url' being on localhost and the PayPal servers not being able to call it, right?
... View more