使用Rest API,PayPal正在使用沙箱,但不能用于实时

时间:2018-10-23 11:07:57

标签: angular paypal paypal-sandbox

我已将PayPal与我的angular 2应用程序与REST API应用程序集成在一起。它可以在沙盒环境中正常工作,但不能在实时环境中工作。共享我使用的代码:

paypalConfig = {
env: 'production',
client: {
  sandbox: 'my_sandbox_client_key',
  production: 'my_live_client_key'
},
commit: true,
style: {
  color: 'gold',   // 'gold, 'blue', 'silver', 'black'
  size:  'medium', // 'medium', 'small', 'large', 'responsive'
  shape: 'pill'    // 'rect', 'pill'
},
payment: (data, actions) => {
  return actions.payment.create({
    payment: {
      transactions: [
        { amount: { total: this.finalAmount, currency: 'USD' } }
      ]
    }
  });
},
onAuthorize: (data, actions) => {
  return actions.payment.execute().then((payment) => {
    //Do something when payment is successful.
    alert('Payment Successful, Thank You!');
  })
}};

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);
    })
}

这是我收到的失败消息:

Screenshot of PayPal's US account for live transaction failed

谢谢。

0 个答案:

没有答案