问题
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.
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.
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"
}
}
But it gives me an error:
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.
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?
回答1:
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.
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.
来源:https://stackoverflow.com/questions/46483056/payment-error-paypal-error-invalid-request-see-details-validation-error-pa