【问题标题】:Verify an email address is a paypal user验证电子邮件地址是贝宝用户
【发布时间】:2012-04-25 02:50:01
【问题描述】:

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

有没有一个 ruby​​ 库可以做到这一点?

谢谢

【问题讨论】:

    标签: ruby-on-rails ruby paypal


    【解决方案1】:

    来自PayPal's Adaptive Accounts 平台的GetVerifiedStatus 将为您执行此操作。

    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
    

    注意:PayPal 显然尚未更新其 API 参考页面,因此请暂时使用 Adaptive Accounts guide 中第 65-66 页中包含的信息。

    【讨论】:

    • 这让我受益匪浅,谢谢
    • @macarthy,你好!我正在使用您的帖子,但不断收到“哎呀!对不起!出了点严重问题”。你能看这里 - >stackoverflow.com/questions/11491352/… 吗?
    【解决方案2】:

    查看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 => "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
    

    here是paypal的自适应账户官方文档

    【讨论】:

      猜你喜欢
      • 2012-11-26
      • 1970-01-01
      • 2013-08-03
      • 1970-01-01
      • 2013-06-07
      • 2013-10-16
      • 2014-11-25
      • 2020-08-14
      • 2014-06-12
      相关资源
      最近更新 更多