Angular6 如何整合Paypal帐户Live
目前我们无法使用您的PayPal帐户处理您的付款。请返回商户并尝试使用其他付款方式 如何使用angular6让paypal帐户上线我已经尝试过这段代码,但它不起作用,它在sandbox中运行良好,但在生产级别上不起作用Angular6 如何整合Paypal帐户Live,angular6,Angular6,目前我们无法使用您的PayPal帐户处理您的付款。请返回商户并尝试使用其他付款方式 如何使用angular6让paypal帐户上线我已经尝试过这段代码,但它不起作用,它在sandbox中运行良好,但在生产级别上不起作用 **code** import { Component,AfterViewChecked } from '@angular/core'; declare let paypal: any; @Component({ selector: 'app-root', templ
**code**
import { Component,AfterViewChecked } from '@angular/core';
declare let paypal: any;
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements AfterViewChecked {
addScript: boolean = false;
paypalLoad: boolean = true;
finalAmount: number = 1;
paypalConfig = {
env: 'production',
client: {
//sandbox: '';
production:'';
},
commit: true,
payment: (data, actions) => {
return actions.payment.create({
payment: {
transactions: [
{ amount: { total: this.finalAmount, currency: 'USD' } }
]
}
});
},
onAuthorize: (data, actions) => {
return actions.payment.execute().then((payment) => {
alert('Transaction completed');
//Do something when payment is successful.
})
}
};
ngAfterViewChecked(): void {
if (!this.addScript) {
this.addPaypalScript().then(() => {
paypal.Button.render(this.paypalConfig, '#paypal-checkout-btn');
this.paypalLoad = false;
})
}
}
addPaypalScript() {
this.addScript = true;
return new Promise((resolve, reject) => {
let scripttagElement = document.createElement('script');
scripttagElement.src = 'https://www.paypalobjects.com/api/checkout.js';
scripttagElement.onload = resolve;
document.body.appendChild(scripttagElement);
})
}
}
当您从沙箱模式切换到生产模式时,一切都应该正常工作-确保您传递了正确的凭据。 出现上述错误的原因可能多种多样,需要更多的详细信息来调查该问题,因此建议您向PayPal支持团队提出查询