failed to load the PayPal JS SDK script TypeError: Load failed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Our system has been use paypal sdk and paypal advance JS Sdk to load the patments for a long TIme,
but there have a lot customer can't load that sdk recently. I need. some help to know whether the mistake in my code.
The error message like this:
[system] failed to load the PayPal JS SDK script Error: The script "https://www.paypal.com/sdk/js?client-id=AYDr8pQoXnoLb7kcUGToxbazY_ssBBsQ5EscoRHnJ2FqF1O2qnEf8fgxDsPE9uUZNNXlgEBzBkHIUGnk&components=buttons,hosted-fields&locale=en_GB¤cy=GBP&enable-funding=card&disable-funding=credit" failed to load.
The code that I have use bellow:
loadScript({
clientId: paypal_client_id,
dataClientToken: res.client_token,
components: ['buttons','hosted-fields'],
locale: 'en_GB',
currency: 'GBP',
'enable-funding': 'card',
'disable-funding': 'credit'
})
.then((paypal) => {
let _this = this;
// If this returns false or the card fields aren't visible, see Step #1.
_this.payOrderId = null;
setTimeout(()=>{
_this.payLoadDone = true;
},1000)
if (paypal.HostedFields.isEligible()) {
// Renders card fields
paypal.HostedFields.render({
// Call your server to set up the transaction
createOrder: function() {
return fetch('https://myServer/payPal/createCardOrder?oId='+ _this.orderId,
{
method: 'get',
headers: {
'Content-Type': 'application/json',
'refreshToken': uni.getStorageSync('refreshToken'),
'token': uni.getStorageSync('token'),
}
}).then(function(res) {
return res.json();
}).then(function(orderData) {
if(orderData.code == 50033) {
uni.navigateTo({
url: `/pages/orders/orderSecondPage/paySuccess?orderId=${_this.orderId}&tpye=pay`
})
return
}
return _this.payOrderId;
}).catch(error => {
uni.showToast({
icon: 'none',
title: error
})
});
},
styles: {
'.valid': {
'color': 'green'
},
'.invalid': {
'color': 'red'
}
},
fields: {
number: {
selector: "#card-number",
placeholder: "**** **** **** ****"
},
cvv: {
selector: "#cvv",
placeholder: "***"
},
expirationDate: {
selector: "#expiration-date",
placeholder: "MM/YY"
}
},
}).then( (cardFields)=> {
_this.canSubmit = true;
_this.cardFields = cardFields;
})
.catch((error) => {
this.payLoadDone = false;
this.showErrorModal = true;
});
} else {
// Hides card fields if the merchant isn't eligible
document.querySelector("form").style = 'display: none';
}
// paypal
// .render("#your-container-element")
// .catch((error) => {
// this.payLoadDone = false;
// this.showErrorModal = true;
// });
})
.catch((error) => {
//. some customer got this error message.
console.error("failed to load the PayPal JS SDK script", error);
this.payLoadDone = false;
this.showErrorModal = true;
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Did you ever get this fixed? I am seeing s similar issue where the SDK js fails to load it is had been happening intermittently since around 17th July.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Check out this post: https://www.paypal-community.com/t5/SDKs/Paypal-SDK-not-loading-in-Safari-16-6/m-p/3090733/highlight... It's a known issue that more than a few of us are experiencing.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Connect To PayPal script failed to show the button on recent websites built. in PayPal Payments Standard
- Change the button from Sandbox to Production in REST APIs
- When I do PayPal capture Order, I keep on getting Invalid Request Connection in REST APIs
- How do I fix this error message: failed to load the PayPal JS SDK script. in SDKs
- Payment not automatically being captured, funds not transferred in Sandbox Environment