简体   繁体   English

PayPal自适应付款 - 如何获取帐户ID?

[英]PayPal Adaptive Payments - How do I get an account ID?

I'm trying to use the PayPal Adaptive Payments Payment API. 我正在尝试使用PayPal自适应付款付款API。 I am trying to test the API with my own email address, but I get an error specifying the sender by email. 我正在尝试使用自己的电子邮件地址测试API,但是通过电子邮件指定发件人时出错。 I'm wondering how to determine my own account ID to try that way? 我想知道如何确定我自己的帐户ID来尝试这种方式?

I'm referring to the account id here: https://developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/ 我在这里指的是帐户ID: https//developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/

I get the error: "The email address smithd98@gmail.com is invalid. It may not be registered in PayPal's system yet" when trying to pay by my email. 我收到错误: "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" When I log in with PayPal my email address is correct. 当我使用PayPal登录时,我的电子邮件地址是正确的。 My account is verified with a bank account, credit card, and debit card connected. 我的帐户已通过银行帐户,信用卡和借记卡进行了验证。

Here is my code: 这是我的代码:

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

You can get it via the API using GetPalDetails . 您可以使用GetPalDetails通过API获取它。 You can get it manually in your PayPal profile. 您可以在PayPal个人资料中手动获取。 Go to the Business Info section and you'll see a Merchant Account ID. 转到“商家信息”部分,您会看到商家帐户ID。

On another note, I see that you're using localhost in your return and cancel URL's, as well as IPN. 另一方面,我看到你在返回时使用localhost并取消了URL和IPN。 This isn't going to work. 这不会起作用。 Remember, it's PayPal's server that will be hitting that address. 请记住,PayPal的服务器将会访问该地址。 If they hit localhost, they're just hitting their own server, which isn't going to do what you want, of course. 如果他们遇到localhost,他们只是打自己的服务器,当然不会做你想要的。

If you want to test all of this with your local test server you'll need to use your IP address or setup some DNS and a domain of some sort. 如果您想使用本地测试服务器测试所有这些,则需要使用您的IP地址或设置某些DNS和某种域。 I personally like to follow PayPal's lead and setup a sandbox.domain.com as a test server for any site I'm working on. 我个人喜欢关注PayPal的主角并设置sandbox.domain.com作为我正在处理的任何网站的测试服务器。

David, 大卫,

To get the Account ID of your test accounts. 获取测试帐户的帐户ID。

  1. Login into your sandbox paypal account at https://www.sandbox.paypal.com/ 登录您的沙盒paypal帐户https://www.sandbox.paypal.com/
  2. Click on the "Profile" tab on the top menu 单击顶部菜单上的“配置文件”选项卡
  3. You will see your Account ID for that account beside "Merchant account ID" 您将在“商家帐户ID”旁边看到该帐户的帐户ID

It's the same exact process for a real account but instead login into your real paypal account. 这是一个真实账户的完全相同的过程,而是登录到您真正的PayPal帐户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM