PayPal:'Value too long (max length 10)' 付款金额

PayPal: 'Value too long (max length 10)' in payment amount

我目前正在做一个项目,需要在一些非洲国家使用PayPal账户实现支付。由于在 https://developer.paypal.com/developer/ 中注册的测试帐户,我可以开发一个允许我与 API 交互的演示项目。在制作一些测试用例时,我尝试指定一个非常长的数量(in U$S),以便查看如何处理抛出的错误。 所以,看看这个异常,我看到了以下痕迹:

{"name":"VALIDATION_ERROR","details":[{"field":"transactions[0].amount.details.subtotal","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"},{"field":"transactions[0].item_list.items[0].price","issue":"Value too long (max length 10)"},{"field":"transactions[0].amount.total","issue":"Value too long (max length 10)"},{"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"},{"field":"transactions[0].item_list.items[0].price","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"},{"field":"transactions[0].amount.details.subtotal","issue":"Value too long (max length 10)"}],"message":"Invalid request - see details","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#VALIDATION_ERROR","debug_id":"12d1b9e203241"}

看到information_link上提到的文档我看到这一段:

Value too long (max length 10)

Provide a value that is 10 characters or less.

重要的是要说明我正在使用美元作为货币(ISO 代码:USD),所以,此时我想知道:其他货币呢? 正如我所说,我的应用程序将与尼日利亚等非洲国家合作(即),其货币奈拉估值为 0.005013 U.S。每个美元,这可能会使小数点后 10 位不够用。 有人有这个问题吗?无论使用哪种货币,我都应该始终限制在小数点后 10 位吗?

(无法实现货币转换!)

...so, at this point i'm wondering: what about other currencies?

可以找到 REST API 支持的 PayPal 货币列表 here

As I said, my application will be working with african countries like Nigeria (i.e.) whose currency is Naira valuated to 0.005013 U.S. dollars for each one, which could make that 10 decimal places are not enough. Someone has this issue?

很遗憾,PayPal 目前不支持尼日利亚奈拉货币。如果您确实需要在 USD 内进行操作,那么您的操作数额将被限制为最多保留 2 位小数。

Shall I am always limited to 10 decimal places no matter the currency?

如果您查看错误详细信息,它会通过 "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".[=16= 来澄清这一点]

所以总共可以有 10 个字符,而不是小数位。例如,“1234567.90”是有效的,其中小数点包含在字符数中。此最大字符数与列出的受支持货币的最大 PayPal 交易限额一致 here