21

I want to integrate paypal to my website and ask users to enter paypal account for commission pay out. How can I check if their account exists on paypal? I prefer NOT to send them $0.01 or it's the only way to check account?

It should validate it automatically while user sign ups to the website.

Andrey
  • 219
  • 1
  • 2
  • 6

6 Answers6

7

GetVerifiedStatus should do the trick. You'll have to pass the email address and the name of the person and it will then return whether or not their account has been verified.

If they don't have a PayPal account you'll get an error back that says "Cannot determine PayPal Account status."

Here's a sample of the request and response I just ran on the sandbox for a verified PayPal account...

<?xml version="1.0" encoding="utf-8"?>
<GetVerifiedStatusRequest xmlns="http://svcs.paypal.com/types/ap">
  <requestEnvelope xmlns="">
    <detailLevel>ReturnAll</detailLevel>
    <errorLanguage>en_US</errorLanguage>
  </requestEnvelope>
  <emailAddress xmlns="">sandbo_1204199080_biz@angelleye.com</emailAddress>
  <matchCriteria xmlns="">NAME</matchCriteria>
  <firstName xmlns="">Drew</firstName>
  <lastName xmlns="">Angell</lastName>
</GetVerifiedStatusRequest>

<?xml version='1.0' encoding='UTF-8'?>
<ns2:GetVerifiedStatusResponse xmlns:ns2="http://svcs.paypal.com/types/aa">
  <responseEnvelope>
    <timestamp>2013-01-05T00:07:01.729-08:00</timestamp>
    <ack>Success</ack>
    <correlationId>3fecb3e1f2011</correlationId>
    <build>4055066</build>
  </responseEnvelope>
  <accountStatus>VERIFIED</accountStatus>
  <userInfo>
    <emailAddress>sandbo_1204199080_biz@angelleye.com</emailAddress>
    <accountType>BUSINESS</accountType>
    <accountId>E7BTGVXBFSUAU</accountId>
    <name>
      <salutation></salutation>
      <firstName>Drew</firstName>
      <middleName></middleName>
      <lastName>Angell</lastName>
      <suffix></suffix>
    </name>
    <businessName>Drew Angell's Test Store</businessName>
  </userInfo>
</ns2:GetVerifiedStatusResponse>

And here's a sample of a request and response where the PayPal account doesn't exist...

<?xml version="1.0" encoding="utf-8"?>
<GetVerifiedStatusRequest xmlns="http://svcs.paypal.com/types/ap">
  <requestEnvelope xmlns="">
    <detailLevel>ReturnAll</detailLevel>
    <errorLanguage>en_US</errorLanguage>
  </requestEnvelope>
  <emailAddress xmlns="">nodice@fail.com</emailAddress>
  <matchCriteria xmlns="">NAME</matchCriteria>
  <firstName xmlns="">Drew</firstName>
  <lastName xmlns="">Angell</lastName>
</GetVerifiedStatusRequest>

<?xml version='1.0' encoding='UTF-8'?>
<ns3:FaultMessage xmlns:ns3="http://svcs.paypal.com/types/common" xmlns:ns2="http://svcs.paypal.com/types/aa">
  <responseEnvelope>
    <timestamp>2013-01-05T00:08:28.581-08:00</timestamp>
    <ack>Failure</ack>
    <correlationId>43364ce704211</correlationId>
    <build>4055066</build>
  </responseEnvelope>
  <error>
    <errorId>580023</errorId>
    <domain>PLATFORM</domain>
    <subdomain>Application</subdomain>
    <severity>Error</severity>
    <category>Application</category>
    <message>Cannot determine PayPal Account status</message>
  </error>
</ns3:FaultMessage>
Drew Angell
  • 25,968
  • 5
  • 32
  • 51
  • 2
    The problem with this is it also requires the user to enter their firstName and lastName EXACTLY as it appears on their PayPal account, or else it fails. – Doug S Oct 15 '13 at 18:27
  • 1
    @DougS You don't need the users name if you set the `matchCriteria` field to `NONE` – robmcvey Oct 31 '13 at 10:36
  • 5
    @robmcvey PayPal doesn't allow you to use matchCriteria=NONE. They reserve that ability solely for a select few of their partners. Believe me, I've tried. Our company has been approved for a lot of PayPal API access over the years, but they won't yield on matchCriteria=NONE. – Doug S Nov 04 '13 at 01:01
  • 3
    The repsonse I got from PayPal was that matchCriteria=NONE is reserved for use only they largest customers. They don't trust anyone else. Can't think of any security risk in checking to see whether an account email is verified so PayPal is just being a PITA. @Andrew yes, a lot of users do provide wrong information all the time and also don't enter it exactly the same in every system. It's a shame PayPal is restrictive on this. – Jordan Nov 03 '14 at 10:06
4

With Java (we can do something like using adaptiveaccountssdk)

<dependency>
    <groupId>com.paypal.sdk</groupId>
    <artifactId>adaptiveaccountssdk</artifactId>
    <version>LATEST</version>
</dependency>

...

Map<String, String> sdkConfig = new HashMap<>();
sdkConfig.put("mode", "sandbox/live");
sdkConfig.put("acct1.UserName", "");
sdkConfig.put("acct1.Password", ""));
sdkConfig.put("acct1.Signature", ""));
sdkConfig.put("acct1.AppId", ""));

GetVerifiedStatusRequest request = new GetVerifiedStatusRequest();
AccountIdentifierType accountIdentifierType = new AccountIdentifierType();
accountIdentifierType.setEmailAddress(accountEmail);
request.setAccountIdentifier(accountIdentifierType);
request.setMatchCriteria("NONE");
AdaptiveAccountsService aas = new AdaptiveAccountsService(sdkConfig);
GetVerifiedStatusResponse response = aas.getVerifiedStatus(request);
String status = response.getAccountStatus();

.....

sojin
  • 4,527
  • 2
  • 37
  • 40
  • Does this code guarantee that the user account will be verified? I am getting this error.. INFO: responseEnvelope.timestamp=2015-12-17T01%3A14%3A59.665-08%3A00&responseEnvelope.ack=Failure&responseEnvelope.correlationId=9ee14ddcd7e99&responseEnvelope.build=18679799&error(0).errorId=580023&error(0).domain=PLATFORM&error(0).subdomain=Application&error(0).severity=Error&error(0).category=Application&error(0).message=Cannot +determine+PayPal+Account+status Can you or anybody please help!!? – Abdullah Khan Dec 17 '15 at 09:19
4

you can ask them to enter the email address they use in paypal. and if they dont have an account on paypal, you can still send them funds to any email they enter. Paypal will take care of getting them to create an paypal account with that email id and show them their funds.

all you may have to ensure is that they enter the correct email id.. maybe an email address verification step could do the trick.

Kinjal Dixit
  • 7,777
  • 2
  • 59
  • 68
  • It should validate it automatically while user sign ups. – Andrey Jul 12 '10 at 19:45
  • 1
    you mean you want to check if they have a valid paypal account before you send them money? you must have a unique problem because i would just ask them to enter their paypal id and assume they are doing it right, send them the money and be done with it. it is they who should be worried about entering the right information, not you. unless you are giving money to people who are not particularly interested in receiving it... which is what i mean by you must have a unique problem. – Kinjal Dixit Jul 12 '10 at 22:00
  • Note: the MassPay and Payments APIs will NOT send money to an email address that hasn't registered an account first! – David Murdoch Feb 05 '16 at 20:26
3

I implemented following script in PHP for GetVerifiedStatus method with API call and it is working fine for me. This script is for sandbox so if you want to test it, please test it with sandbox PayPal accounts. If you want to use it for production mode, then delete the lines for sandbox (I showed them in the comment hints) . I explained about the things you need to get from paypal to run this code inside the PHP comments.

<?php
// create a new cURL resource
$ch = curl_init();

$ppUserID = "******************"; //Take it from   sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppPass = "*************"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppSign = "********************"; //Take it from sandbox dashboard for test mode or take it from paypal.com account in production mode, help: https://developer.paypal.com/docs/classic/api/apiCredentials/
$ppAppID = "***********"; //if it is sandbox then app id is always: APP-80W284485P519543T
$sandboxEmail = "********************"; //comment this line if you want to use it in production mode.It is just for sandbox mode

$emailAddress = "******************"; //The email address you wana verify
$firstName = "********"; //first name of the account holder you want to verify, sandbox personal account default first name is: test
$lastName = "*******"; //last name of the account holder you want to verify, sandbox personal account default last name is: buyer

//parameters of requests
$nvpStr = 'emailAddress='.$emailAddress.'&firstName='.$firstName.'&lastName='.$lastName.'&matchCriteria=NAME';

// RequestEnvelope fields
$detailLevel    = urlencode("ReturnAll");   // See DetailLevelCode in the WSDL for valid enumerations
$errorLanguage  = urlencode("en_US");       // This should be the standard RFC 3066 language identification tag, e.g., en_US
$nvpreq = "requestEnvelope.errorLanguage=$errorLanguage&requestEnvelope.detailLevel=$detailLevel";
$nvpreq .= "&$nvpStr";
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

$headerArray = array(
"X-PAYPAL-SECURITY-USERID:$ppUserID",
"X-PAYPAL-SECURITY-PASSWORD:$ppPass",
"X-PAYPAL-SECURITY-SIGNATURE:$ppSign",
"X-PAYPAL-REQUEST-DATA-FORMAT:NV",
"X-PAYPAL-RESPONSE-DATA-FORMAT:JSON",
"X-PAYPAL-APPLICATION-ID:$ppAppID",
"X-PAYPAL-SANDBOX-EMAIL-ADDRESS:$sandboxEmail" //comment this line in production mode. IT IS JUST FOR SANDBOX TEST 
);

$url="https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus";
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArray);
$paypalResponse = curl_exec($ch);
//echo $paypalResponse;   //if you want to see whole PayPal response then uncomment it.
curl_close($ch);

$data = json_decode($paypalResponse);

if($data->responseEnvelope->ack == "Success"){
$output = array('status' => true); //means user is verified successfully
} else {
$output = array('status' => false); //means verification was unsuccessful
}

echo $output;

?>
Iman Sedighi
  • 7,624
  • 4
  • 48
  • 55
0

Having a verified PayPal account means that you have provided PayPal additional information to prove your identify. This gives potential customers more confidence in your legitimacy, and qualifies you to be covered under PayPal's Seller Protection. Verifying your account also removes account limits and enables you to transfer money between your PayPal account and your other linked bank accounts.

0

The answers to this 12-year-old question are likewise old.

The best way simply validate a PayPal account is to have the user Log in with PayPal

Preston PHX
  • 27,642
  • 4
  • 24
  • 44