我想验证一个电子邮件地址是 PayPal 用户。是否有 API 调用可以做到这一点?
有没有这样做的红宝石库?
谢谢
来自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 页中包含的信息。
查看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
这是贝宝的自适应账户官方文档