Device OS Version and Device (iOS 9.x on an iPhone 6, Android Marshmallow on Nexus 6, etc.):
Tested on
Android v4.4.2 on Infinix-x551
Android v5.0 on Lenovo X2-EU
Android v5.1 on Inifnix-x551
Android v6.0.1 on Samsung SM-G925I
Apple - iPhone 6 v9.2.1
Apple - iPad Mini v9.3.2
PayPal-Debug-ID(s) (from any logs):
not available
Issue Description:
As soon as I initiate the payment by running the following code:
payPalCheckout : function () {
that = router.activeItem();
self = this;
function initPaymentUI() {
console.log("initPaymentUI");
var clientIDs = {
"PayPalEnvironmentProduction": app.PayPalEnvironmentProduction,
"PayPalEnvironmentSandbox" : app.PayPalEnvironmentSandbox
};
PayPalMobile.init(clientIDs, onPayPalMobileInit);
}
function onPayPalMobileInit() {
// must be called
// use PayPalEnvironmentNoNetwork mode to get look and feel of the flow
if (app.PayPalEnvironment == "prod") {
PayPalMobile.prepareToRender("PayPalEnvironmentProduction", configuration(), onPrepareRender);
} else {
PayPalMobile.prepareToRender("PayPalEnvironmentSandbox", configuration(), onPrepareRender);
}
}
function configuration() {
// for more options see `paypal-mobile-js-helper.js`
var config = new PayPalConfiguration({
merchantName : "SM",
merchantPrivacyPolicyURL: "http://www.example.com/mobapp/smapp/#help",
merchantUserAgreementURL: "http://www.example.com/mobapp/smapp/#help"
});
return config;
}
function onPrepareRender() {
// single payment
PayPalMobile.renderSinglePaymentUI(createPayment(), onSuccesfulPayment, onUserCanceled);
}
function createPayment() {
// for simplicity use predefined amount
// optional payment details for more information check [helper js file](https://github.com/paypal/PayPal-Cordova-Plugin/blob/master/www/paypal-mobile-js-helper.js)
var paymentDetails = new PayPalPaymentDetails("5", "0.00", "0.00");
var payment = new PayPalPayment("5", "GBP", "SwopMarket Cart: ", "Sale", paymentDetails);
console.log("payment", payment);
return payment;
}
function onSuccesfulPayment(payment) {
console.log('onSuccesfulPayment success ', payment);
console.log("payment success: " + JSON.stringify(payment, null, 2));
if (payment.response.state == "approved") {
self.addOrderToDB(payment);
} else {
uikit.notify("<div class='uk-text-center'>Cancelled by user.</div>", {status: 'warning'});
}
}
function onUserCanceled(result) {
uikit.notify("<div class='uk-text-center'> Payment Error! <br/> There seems to be something wrong. Please try again in a moment. </div>", {status: 'warning'});
console.log("result", result);
}
initPaymentUI();
},
and the plugin is launched the following screen with error "Try Again: There was a problem communicating with the PayPal servers. Please try again."
Required Information
Mode (Mock/Sandbox/Live): Sandbox
Cordova Plugin Version: 3.1.17
Platforms (iOS/Android/Both): Both
Device OS Version and Device (iOS 9.x on an iPhone 6, Android Marshmallow on Nexus 6, etc.): Tested on
PayPal-Debug-ID(s) (from any logs): not available
Issue Description: As soon as I initiate the payment by running the following code:
and the plugin is launched the following screen with error "Try Again: There was a problem communicating with the PayPal servers. Please try again."
Using following plugins in my phonegap build: