aircraft
aircraft

Reputation: 26886

Currency amount must be non-negative number, may optionally contain exactly 2 decimal places separated by '.'

When I use the vue-paypal-check:

 <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`
  }
},

I get bellow error:

{"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount.total","issue":"Currency amount must be non-negative number, may optionally contain exactly 2 decimal places separated by '.', optional thousands separator ',', limited to 7 digits before the decimal point"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"efa7b058ad30e"}

Upvotes: 0

Views: 1079

Answers (1)

aircraft
aircraft

Reputation: 26886

Afterwards I found the issue, I was follow the GitHub steps:

<PayPal
  amount="10.00"
  currency="USD"
  :client="credentials">
</PayPal>

the 10.00 is the given number, I'm passing a variable, I should use the

<PayPal
  :amount="amount"
  currency="USD"
  :client="credentials">
</PayPal>

Then I solved my problem.

Upvotes: 0

Related Questions