2012-04-12 109 views

回答

7

GetVerifiedStatusPayPal's Adaptive Accounts平臺會爲你做到這一點。

PayPal沒有任何code samplesSDKs適用於Ruby中的適應性帳戶,但我確實找到了編寫code for GetVerifiedStatus in Ruby的人。

該代碼的唯一變化,你需要把它檢查他們有什麼類型的帳戶是改變

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 

注意:貝寶顯然沒有更新他們的API參考頁面,因此暫時使用Adaptive Accounts guide中第65-66頁上的信息。

+1

這已經得到了我很多的方式,感謝 – macarthy 2012-04-18 21:44:19

+0

@macarthy,你好!我正在使用你的帖子,但常常得到「哎呀!對不起,有些事情嚴重錯了」。你可以看看這裏 - > http://stackoverflow.com/questions/11491352/cant-verifycheck-paypal-account? – skrypalyk 2012-07-15 17:37:04

4

查看adaptiveaccounts-sdk-ruby gem。它可以讓你獲得有關貝寶賬戶的信息。

看看the sample apps看看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 => "[email protected]", 
    :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 

here是PayPal的自適應官方文檔佔

+2

謝謝@sam .......它像一個魅力工作! – LHH 2014-01-02 08:08:42

+0

老兄你救了我的生命哈哈 – 2015-04-22 08:02:23

相關問題