cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix PayPal's 'Validation Error' in Node JS?

New Community Member

How to fix PayPal's 'Validation Error' in Node JS?

I'm trying to send a request to the PayPal api with an order. However, every time I send a request I'm getting this error:


>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 and currency which is a valid ISO Currency Code


I have looked at my request object, but all the values conform to the information PayPal requires. The amount.total is two digits, and the ISO Currency Code is correct, yet I'm still getting the same error.

This is the JSON I'm sending:

{ 
"amount":{ 
"total":24.51,
"currency":"USD",
"details":{ 
"subtotal":22.99,
"tax":0.06625
}
},
"description":"Nature Prints produced by Jonah's Photos.",
"invoice_number":"deb03d30-69e5-11e9-bc27-855d4a6ff0e2",
"payment_options":{ 
"allowed_payment_method":"INSTANT_FUNDING_SOURCE"
},
"item_list":{ 
"items":[ 
{ 
"name":"IMG_9454 | Nature Photo @ 8.5\" x 11\" |",
"quantity":1,
"price":14.99,
"tax":0.06625,
"sku":"40751898403_90408c24a3",
"currency":"USD"
}
]
}
}

 

 

I'm expecting the request to successfully completed, but I get the same error every time.