本文介绍了付款错误:PayPal错误:无效的请求.查看具体信息. (VALIDATION_ERROR)贝宝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中使用PayPal定期付款.我想在一段时间内进行一次免费试用,初始订单总数应为零,一旦免费试用完成,实际订单金额将从帐户中扣除.

I'm working with PayPal recurring payments in my project. And I want to give one free trial for some amount of time period, and initial order total should be zero, once free trial has completed the actual amount of order will be deducted from account.

例如,用户购买一种产品(100美元)并应用折扣代码进行免费试用,然后首次下单时应支付0美元,一旦试用结束,系统就会运行100美元.

For instance, user purchase one product($100 USD) and apply discount code for free trial then first order should be placed with $0 USD, once trial over, $100 USD cycle will running up.

为此,我将MerchantPreferences中的"0"传递给setup_fee:

For that I'm passing "0" to setup_fee in MerchantPreferences:

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"
    }
}

但这给我一个错误:

如果我传递一些值而不是0.00,则它工作正常,但是我想发送零作为初始金额.

If I pass some values instead of 0.00 it's working properly, but I want to send zero as initial amount.

谁能告诉我我的代码出了什么问题?

Can anyone tell me what's wrong with my code?

推荐答案

错误描述了缺少的"Note"参数和无效的"currency".您是否已检查是否为currency发送null值,或者当值为0时不发送Note参数?从您的代码看来,如果currencynullcurrency.CurrencyCodenull,则您正在发送null值,而PayPal不允许这样做.

The errors describe a missing 'Note' parameter and an invalid 'currency'. Have you checked that you are not sending a null value for currency, or skipping sending the Note parameter, when the value is 0? It seems possible from your code, that if either currency is null or currency.CurrencyCode is null, you are sending a null value where PayPal does not allow this.

顺便说一句,我知道许多财务驱动的站点都以大约1美分而不是0的存款价值工作,以验证钱是否已正确转移.

On a side note, I know that many financially driven sites work with a deposit value of ~1 cent, rather than 0, to verify that money is properly transferred.

这篇关于付款错误:PayPal错误:无效的请求.查看具体信息. (VALIDATION_ERROR)贝宝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 10:58