【问题标题】:How to validate PayPal account?如何验证 PayPal 帐户?
【发布时间】:2011-03-14 19:48:39
【问题描述】:

我想将 paypal 整合到我的网站,并要求用户进入 paypal 帐户以支付佣金。 我如何检查他们的帐户是否存在于贝宝上? 我不想给他们 0.01 美元,否则这是检查帐户的唯一方法?

它应该在用户注册网站时自动验证。

【问题讨论】:

    标签: api validation paypal


    【解决方案1】:

    GetVerifiedStatus 应该可以解决问题。您必须传递电子邮件地址和此人的姓名,然后无论他们的帐户是否已通过验证,它都会返回。

    如果他们没有 PayPal 帐户,您将收到一条错误消息,显示“无法确定 PayPal 帐户状态”。

    这是我刚刚在沙盒上为已验证的 PayPal 帐户运行的请求和响应示例...

    <?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>
    

    这是一个请求和响应的示例,其中 PayPal 帐户不存在...

    <?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>
    

    【讨论】:

    • 这个问题是它还要求用户输入他们的名字和姓氏,因为它显示在他们的 PayPal 帐户上,否则它会失败。
    • @DougS 如果将matchCriteria 字段设置为NONE,则不需要用户名
    • @robmcvey PayPal 不允许您使用 matchCriteria=NONE。他们只为少数几个合作伙伴保留这种能力。相信我,我已经试过了。多年来,我们公司已获准进行大量 PayPal API 访问,但他们不会在 matchCriteria=NONE 上取得成功。
    • 我从 PayPal 得到的回复是 matchCriteria=NONE 保留给他们最大的客户使用。他们不相信任何人。在检查帐户电子邮件是否经过验证时无法想到任何安全风险,因此 PayPal 只是一个 PITA。 @Andrew是的,很多用户确实一直提供错误的信息,而且在每个系统中输入的信息也不完全相同。很遗憾 PayPal 对此有限制。
    【解决方案2】:

    您可以要求他们输入他们在贝宝中使用的电子邮件地址。如果他们在贝宝上没有帐户,您仍然可以将资金发送到他们输入的任何电子邮件中。 Paypal 将负责让他们使用该电子邮件 ID 创建一个 paypal 帐户并向他们显示他们的资金。

    您可能需要确保他们输入正确的电子邮件 ID。也许电子邮件地址验证步骤可以解决问题。

    【讨论】:

    • 它应该在用户注册时自动验证。
    • 您的意思是您想在向他们汇款之前检查他们是否拥有有效的贝宝账户?你一定有一个独特的问题,因为我只会要求他们输入他们的贝宝 ID,并假设他们做得对,把钱寄给他们就可以了。应该担心输入正确信息的是他们,而不是您。除非你把钱捐给那些对接收不是特别感兴趣的人......我的意思是你一定有一个独特的问题。
    • 注意:MassPay 和 Payments API 不会向未先注册帐户的电子邮件地址汇款!
    【解决方案3】:

    使用 Java(我们可以使用 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();
    

    .....

    【讨论】:

    • 此代码是否保证用户帐户将被验证?我收到此错误.. 信息: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 你或者任何人可以帮忙!!?
    【解决方案4】:

    我在 PHP 中使用 API 调用为 GetVerifiedStatus 方法实现了以下脚本,它对我来说工作正常。此脚本适用于沙盒,因此如果您想对其进行测试,请使用沙盒 PayPal 帐户对其进行测试。如果您想将其用于生产模式,请删除沙箱的行(我在评论提示中显示了它们)。我解释了在 PHP cmets 中运行此代码需要从 paypal 获取的内容。

    <?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;
    
    ?>
    

    【讨论】:

      【解决方案5】:

      拥有经过验证的 PayPal 帐户意味着您已提供 PayPal 附加信息来证明您的身份。这让潜在客户对您的合法性更有信心,并使您有资格享受 PayPal 的卖家保护。验证您的帐户还可以消除帐户限制,并使您能够在您的 PayPal 帐户和其他关联的银行帐户之间进行转账。

      【讨论】:

        猜你喜欢
        • 2016-03-01
        • 2016-06-20
        • 2015-10-25
        • 2014-01-01
        • 2012-06-14
        • 2015-03-21
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多