Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Verify an email address is a paypal user

I want to verify that an email address is a PayPal user. Is there an API call to do that?

Is there a ruby lib that does this ?

Thanks

like image 759
macarthy Avatar asked Apr 12 '12 17:04

macarthy


2 Answers

GetVerifiedStatus from PayPal's Adaptive Accounts platform will do this for you.

PayPal does not have any code samples or SDKs for Adaptive Accounts in Ruby, but I did find someone who has written the code for GetVerifiedStatus in Ruby.

The only change to that code you would need to have it check what type of account they have is to change

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

to

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

Note: PayPal apparently has not updated their API reference page, so use the information contained on pages 65-66 in the Adaptive Accounts guide for now.

like image 172
SgtPooki Avatar answered Sep 28 '22 07:09

SgtPooki


Check out the adaptiveaccounts-sdk-ruby gem. It allows you to get information about paypal accounts.

Take a look at the sample apps to see what the api can do.

Here's an example:

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 is paypal's official documentation for adaptive accounts

like image 25
Sam Backus Avatar answered Sep 28 '22 08:09

Sam Backus