Pypal checkout button not loading on live website with ng build code
yogeshjakhar19
New Community Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jan-26-2021
06:51 PM
This work fine for me in local-host with both sandbox and production. But when I run command ng build --prod and publish
code on live website, it starts giving error. Can anyone help me in suggesting what is the issue
paypalConfig = {
env: 'production',
client:{
//sandbox: '<sandbox-key>',
production: '<my-key>'
},
commit: true,
payment: (data, actions) =>{
return actions.payment.create({
payment:{
transactions: [
{
"item_list": {
"items": [{
"name": "Car Upload " + this.firstFormGroup.value.identifier,
"sku": "item",
"price": this.final-amount,
"currency": "USD",
"quantity": this.firstFormGroup.value.quantity
}]
},
amount: {total: this.final-amount*this.firstFormGroup.value.quantity, currency: 'USD'}
}
]
}
});
},
onAuthorize: (data, actions) =>{
return actions.payment.execute().then((payment)=>{
this.payment(payment);
});
}
};
ngAfterViewChecked(): void{
if(!this.addScript){
this.addPaypalScript().then(()=>{
paypal.Button.render(this.paypalConfig, '#paypal-checkout-btn');
})
}
}
addPaypalScript(){
this.addScript = true;
return new Promise((resolve, reject)=>{
let scripttagElement = document.createElement('script');
scripttagElement.onload = resolve;
document.body.appendChild(scripttagElement);
})
}
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.
Related Content
- Using Paypal Smart Buttons for checkout sometimes fails with Debit/ Credit Cards Form in Braintree Client-side Integration (JS, iOS, Android SDKs)
- Customising Paypal Checkout Button in PayPal Payments Standard
- Mandatory Account Creation Hindering Customer Experience in REST APIs
- PayPal Express Checkout charging incorrect values? in Sandbox Environment
- PayPal checkout broken in Safari last 24 hours in PayPal Payments Standard