Paypal 货币金额必须为非负数,可以选择正好包含由';分隔的2位小数';

Paypal 货币金额必须为非负数,可以选择正好包含由';分隔的2位小数';,paypal,vue.js,vue-paypal-check,Paypal,Vue.js,Vue Paypal Check,当我使用 ... 计算:{ 金额(){ var total\u price=Number(此.product\u物理\u session\u storage\u from\u before.total\u price\u local) var abs_total_price=Math.abs(toFixed(2)) 返回abs\u总价//编号为'120.00` } }, 我得到以下错误: {“name”:“VALIDATION_ERROR”,“details”:[{“field”:“tran

当我使用


...
计算:{
金额(){
var total\u price=Number(此.product\u物理\u session\u storage\u from\u before.total\u price\u local)
var abs_total_price=Math.abs(toFixed(2))
返回abs\u总价//编号为'120.00`
}
},
我得到以下错误:

{“name”:“VALIDATION_ERROR”,“details”:[{“field”:“transactions[0]。amount.total”,“issue”:“Currency amount”必须是非负数,可以选择正好包含由“.”分隔的2位小数位,可选的千位分隔符“,”,小数点“}],“message”:“无效请求-请参阅详细信息”,“信息链接”:”,“调试id”:“efa7b058ad30e”}


后来我发现了这个问题,我遵循了:

然后我解决了我的问题

 <PayPal amount="amount"
         currency="USD"
         :client="credentials"
         env="sandbox"
        >
 </Paypal>  
...
computed: {
  amount() {

    var total_price = Number(this.product_physical_session_storage_from_before.total_price_local)

    var abs_total_price = Math.abs(total_price.toFixed(2))

    return abs_total_price  // there is Number `120.00`
  }
},
<PayPal
  amount="10.00"
  currency="USD"
  :client="credentials">
</PayPal>
<PayPal
  :amount="amount"
  currency="USD"
  :client="credentials">
</PayPal>