gpt4 book ai didi

.net - PayPal:付款金额为 'Value too long (max length 10)'

转载 作者:太空宇宙 更新时间:2023-11-03 16:14:25 25 4
gpt4 key购买 nike

我目前正在做一个项目,需要在一些非洲国家使用PayPal账户实现支付。由于在 https://developer.paypal.com/developer/ 中注册的测试帐户,我可以开发一个允许我与 API 交互的演示项目.在制作一些测试用例时,我尝试指定一个非常长的数量(单位为 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 美元,这可能会使小数点后 10 位不够。有人有这个问题吗?无论使用哪种货币,我都应该始终限制在小数点后 10 位吗?

(无法实现货币转换!)

最佳答案

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

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

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?

如果您查看错误详细信息,它通过说“货币金额必须是非负数,可以选择包含正好由‘.’分隔的 2 个小数位,可选的千位分隔符来澄清这一点',', 限制在小数点前7位"

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

关于.net - PayPal:付款金额为 'Value too long (max length 10)',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29017631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com