![](/img/trans.png)
[英]How can I avoid auth and time issues using Paypal's Adaptive Payments API with Ruby?
[英]PayPal Adaptive Payments - How do I get an account ID?
我正在尝试使用PayPal自适应付款付款API。 我正在尝试使用自己的电子邮件地址测试API,但是通过电子邮件指定发件人时出错。 我想知道如何确定我自己的帐户ID来尝试这种方式?
我在这里指的是帐户ID: https : //developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/
我收到错误: "The email address smithd98@gmail.com is invalid. It may not be registered in PayPal's system yet"
在尝试通过我的电子邮件付款时, "The email address smithd98@gmail.com 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 => "smithd98@gmail.com" }] },
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay" })
#@pay.sender.email = "smithd98@gmail.com"
@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。
另一方面,我看到你在返回时使用localhost并取消了URL和IPN。 这不会起作用。 请记住,PayPal的服务器将会访问该地址。 如果他们遇到localhost,他们只是打自己的服务器,当然不会做你想要的。
如果您想使用本地测试服务器测试所有这些,则需要使用您的IP地址或设置某些DNS和某种域。 我个人喜欢关注PayPal的主角并设置sandbox.domain.com作为我正在处理的任何网站的测试服务器。
大卫,
获取测试帐户的帐户ID。
这是一个真实账户的完全相同的过程,而是登录到您真正的PayPal帐户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.