我正在尝试使用PayPal自适应付款API。我正在尝试使用自己的电子邮件地址来测试API,但是在通过电子邮件指定发件人时出现错误。我想知道如何确定自己的帐户ID来尝试这种方式?
我在这里指的是帐户ID:https : //developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/
我收到错误消息:"The email address [email protected] is invalid. It may not be registered in PayPal's system yet"
尝试通过电子邮件付款时。当我使用PayPal登录时,我的电子邮件地址是正确的。我的帐户已通过银行帐户,信用卡和借记卡进行验证。
这是我的代码:
require 'paypal-sdk-adaptivepayments'
PayPal::SDK.configure(
:mode => "sandbox", # Set "live" for production
:app_id => "HIDDEN",
:username => "HIDDEN",
:password => "HIDDEN",
:signature => "HIDDEN" )
@api = PayPal::SDK::AdaptivePayments.new
# Build request object
@pay = @api.build_pay({
:actionType => "PAY",
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
:currencyCode => "USD",
:feesPayer => "SENDER",
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
:receiverList => {
:receiver => [{
:amount => 1.0,
:email => "[email protected]" }] },
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay" })
#@pay.sender.email = "[email protected]"
@pay.sender.accountId = 23434
# Make API call & get response
puts @pay.inspect
@response = @api.pay(@pay)
# Access response
if @response.success?
puts 'responsepayKey'
@response.payKey
puts 'url to complete payment'
@api.payment_url(@response) # Url to complete payment
else
puts 'error'
puts @response.error[0].message
puts @response.error[1].parameter.value
end
您可以使用GetPalDetails通过API获取它。您可以在您的PayPal个人资料中手动获取。转到“业务信息”部分,您将看到商家帐户ID。
另一方面,我看到您在返回和取消URL以及IPN中使用了localhost。这行不通。请记住,将是贝宝(PayPal)的服务器到达该地址。如果他们使用本地主机,那么它们只是在使用自己的服务器,这当然不会做您想要的。
如果要使用本地测试服务器进行所有这些测试,则需要使用IP地址或设置一些DNS和某种域。我个人喜欢跟随PayPal的领导,将sandbox.domain.com设置为我正在工作的任何站点的测试服务器。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句