5

我想验证一个电子邮件地址是 PayPal 用户。是否有 API 调用可以做到这一点?

有没有这样做的红宝石库?

谢谢

4

2 回答 2

7

来自PayPal 的 Adaptive Accounts平台的GetVerifiedStatus将为您完成这项工作。

PayPal 没有任何用于 Ruby 中自适应帐户的代码示例SDK,但我确实找到了有人在 Ruby 中为 GetVerifiedStatus 编写了代码

您需要让它检查他们拥有的帐户类型的唯一更改是更改

if @xml['accountStatus']!=nil
    account_status = @xml['accountStatus'][0]
    #its pretty obvious from here init?
    if account_status.to_s() == "VERIFIED"
        render :text => "Account verified"
    else
        render :text => "Oopsy! Yet to be verified"
    end
else
    render :text => "Gee! sorry! something went seriously wrong"
end

if @xml['accountType']!=nil
    account_type = @xml['accountType'][0]
    #its pretty obvious from here init?
    if account_type.to_s() == "Business"
        render :text => "Business account!"
    elseif account_type.to_s() == "Premier"
        render :text => "Premier Account!"
    elseif account_type.to_s() == "Personal"
        render :text => "Personal account!"
    else
        render :text => "Account type not null but not a valid PayPal account type."
    end
else
    render :text => "Gee! sorry! something went seriously wrong"
end

注意:PayPal 显然没有更新他们的 API 参考页面,所以现在使用Adaptive Accounts 指南中第 65-66 页中包含的信息。

于 2012-04-13T02:52:57.463 回答
4

查看adaptiveaccounts-sdk-ruby gem。它允许您获取有关贝宝帐户的信息。

查看示例应用程序以了解 api 可以做什么。

这是一个例子:

require 'paypal-sdk-adaptiveaccounts'
@api = PayPal::SDK::AdaptiveAccounts::API.new( :device_ipaddress => "127.0.0.1" )

# Build request object
@get_verified_status = @api.build_get_verified_status({
  :emailAddress => "newEmailAddress@paypal.com",
  :matchCriteria => "NONE" })

# Make API call & get response
@get_verified_status_response = @api.get_verified_status(@get_verified_status)

# Access Response
if @get_verified_status_response.success?
  @get_verified_status_response.accountStatus
  @get_verified_status_response.countryCode
  @get_verified_status_response.userInfo
else
  @get_verified_status_response.error
end

是贝宝的自适应账户官方文档

于 2013-10-01T15:09:30.787 回答