我在我的项目中使用 PayPal 定期付款。我想在一段时间内免费试用一次,初始订单总额应为零,一旦免费试用完成,实际订单金额将从帐户中扣除。
例如,用户购买一件产品(100 美元)并申请免费试用的折扣代码,那么第一笔订单应以 0 美元下单,一旦试用结束,将进入 100 美元的周期。
为此,我将“0”传递给 MerchantPreferences
中的 setup_fee
:
merchant_preferences = new MerchantPreferences
{
return_url = url,
cancel_url = url,
auto_bill_amount = "YES",
setup_fee = new PayPal.Api.Currency
{
currency = currency != null ? currency.CurrencyCode : null,
value = "0.00"
}
}
但它给了我一个错误:
Payment error: PayPal error: Invalid request. See details. (VALIDATION_ERROR)
Payment error: note Note is missing from the request or Note length is too long
Payment error: amount.currency Required field is missing.
如果我传递一些值而不是 0.00
它工作正常,但我想发送零作为初始金额。
谁能告诉我我的代码有什么问题?
最佳答案
错误描述了缺少的“注释”参数和无效的“货币”。您是否检查过您没有为 currency
发送 null
值,或者在值为 0 时跳过发送
?从您的代码看来,如果 Note
参数currency
是 null
或 currency.CurrencyCode
是 null
,那么您是在 PayPal 不允许的情况下发送 null
值。
附带说明一下,我知道许多以财务为导向的网站使用约 1 美分而不是 0 的存款值(value)来验证资金是否已正确转移。
关于c# - 付款错误 : PayPal error: Invalid request. 查看详情。 (VALIDATION_ERROR) Paypal ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46483056/