如何使用php api检查电子邮件或手机paypal帐户状态?

2024-05-10

如何使用 php api 检查电子邮件或手机 Paypal 帐户状态?

好的,如果我想汇款到此电子邮件贝宝 ([email protected] /cdn-cgi/l/email-protection)或手机(1234567890)

汇款前,我可以检查一下吗[email protected] /cdn-cgi/l/email-protection Or 1234567890状态帐户。EG: Active or Not active


是的,您可以通过电子邮件或电话号码获取 PayPal 帐户的状态。您应该使用“GETVERIFIEDSTATUS”API 来实现此目的。您必须提供名字和姓氏以及电子邮件/电话。请参考以下链接获取 API 信息:

https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-accounts/GetVerifiedStatus_API_Operation/#id098QF50F04Y https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-accounts/GetVerifiedStatus_API_Operation/#id098QF50F04Y

除此之外,我还包含了 php 代码:

使用电子邮件时:

  $url = trim("https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus");  //set PayPal Endpoint to sandbox
//$url = trim("https://svcs.paypal.com/AdaptiveAccounts/GetVerifiedStatus");         //set PayPal Endpoint to Live 

$API_UserName = "XXXXXXXXX";                                //PayPal Test API Credentials, Replace it with live if in live mode
$API_Password = "XXXXXXXX"; 
$API_Signature = "XXXXXXXX"; 
$API_AppID = "APP-80W284485P519543T";                                       //Default App ID for Sandbox, replace it with live id if in live mode   
$API_RequestFormat = "NV";
$API_ResponseFormat = "NV";

//Create request payload 
$bodyparams = array (   "requestEnvelope.errorLanguage" => "en_US",
                        "emailAddress" =>"XXXXXXXXX",
                        "firstName" =>"Eshan Business TEST",
                        "lastName" =>"  Account",
                        "matchCriteria" => "NAME"
                    );

// convert payload array into url encoded query string
$body_data = http_build_query($bodyparams, "", chr(38));

try
{
    //create request and add headers
    $params = array("http" => array( 
                                    "method" => "POST",
                                    "content" => $body_data,
                                    "header" => "X-PAYPAL-SECURITY-USERID:     " . $API_UserName . "\r\n" .
                                                "X-PAYPAL-SECURITY-SIGNATURE:  " . $API_Signature . "\r\n" .
                                                "X-PAYPAL-SECURITY-PASSWORD:   " . $API_Password . "\r\n" .
                                                "X-PAYPAL-APPLICATION-ID:      " . $API_AppID . "\r\n" .
                                                "X-PAYPAL-REQUEST-DATA-FORMAT: " . $API_RequestFormat . "\r\n" .
                                                "X-PAYPAL-RESPONSE-DATA-FORMAT:" . $API_ResponseFormat . "\r\n" 
                                    ));


     $ctx = stream_context_create($params);  //create stream context
     $fp = @fopen($url, "r", false, $ctx);   //open the stream and send request
     $response = stream_get_contents($fp);   //get response

    //check to see if stream is open
     if ($response === false) 
     {
        throw new Exception("php error message = " . "$php_errormsg");
     }

     fclose($fp);    //close the stream

    //parse the ap key from the response

    $keyArray = explode("&", $response);

    foreach ($keyArray as $rVal)
    {
        list($qKey, $qVal) = explode ("=", $rVal);
            $kArray[$qKey] = $qVal;
    }

//print the request to screen for testing purposes
echo "Header info:" . "<br>";
print_r($params['http']['header']);
echo "<br><br>" . "Request Info:" . "<br>";
print_r(urldecode($params['http']['content']));
echo "<br><br>" . "Response:" . "<br>";

//print the response to screen for testing purposes
    If ( $kArray["responseEnvelope.ack"] == "Success") 
    {

         foreach ($kArray as $key =>$value)
         {
          echo $key . ": " .$value . "<br/>";
         }
    }
    else 
    {
        foreach ($kArray as $key =>$value)
        {
        echo $key . ": " .$value . "<br/>";
        }       
    }

 }

catch(Exception $e) 
{
    echo "Message: ||" .$e->getMessage()."||";
}

echo "<br>";  
?>

使用电话号码时:

<?php

  $url = trim("https://svcs.sandbox.paypal.com/AdaptiveAccounts/GetVerifiedStatus");  //set PayPal Endpoint to sandbox
//$url = trim("https://svcs.paypal.com/AdaptiveAccounts/GetVerifiedStatus");         //set PayPal Endpoint to Live 

$API_UserName = "XXXXXXXXXXXX";                                //PayPal Test API Credentials, Replace it with live if in live mode
$API_Password = "XXXXXXXXXXXX"; 
$API_Signature = "XXXXXXXXXXX"; 
$API_AppID = "APP-80W284485P519543T";                                       //Default App ID for Sandbox, replace it with live id if in live mode   
$API_RequestFormat = "NV";
$API_ResponseFormat = "NV";

//Create request payload 
$bodyparams = array (   "requestEnvelope.errorLanguage" => "en_US",
                        "accountIdentifier.mobilePhoneNumber" =>"4088359375",
                        "firstName" =>"Eshan Personal Test",
                        "lastName" =>"  Account",
                        "matchCriteria" => "NAME"
                    );

// convert payload array into url encoded query string
$body_data = http_build_query($bodyparams, "", chr(38));

try
{
    //create request and add headers
    $params = array("http" => array( 
                                    "method" => "POST",
                                    "content" => $body_data,
                                    "header" => "X-PAYPAL-SECURITY-USERID:     " . $API_UserName . "\r\n" .
                                                "X-PAYPAL-SECURITY-SIGNATURE:  " . $API_Signature . "\r\n" .
                                                "X-PAYPAL-SECURITY-PASSWORD:   " . $API_Password . "\r\n" .
                                                "X-PAYPAL-APPLICATION-ID:      " . $API_AppID . "\r\n" .
                                                "X-PAYPAL-REQUEST-DATA-FORMAT: " . $API_RequestFormat . "\r\n" .
                                                "X-PAYPAL-RESPONSE-DATA-FORMAT:" . $API_ResponseFormat . "\r\n" 
                                    ));


     $ctx = stream_context_create($params);  //create stream context
     $fp = @fopen($url, "r", false, $ctx);   //open the stream and send request
     $response = stream_get_contents($fp);   //get response

    //check to see if stream is open
     if ($response === false) 
     {
        throw new Exception("php error message = " . "$php_errormsg");
     }

     fclose($fp);    //close the stream

    //parse the ap key from the response

    $keyArray = explode("&", $response);

    foreach ($keyArray as $rVal)
    {
        list($qKey, $qVal) = explode ("=", $rVal);
            $kArray[$qKey] = $qVal;
    }

//print the request to screen for testing purposes
echo "Header info:" . "<br>";
print_r($params['http']['header']);
echo "<br><br>" . "Request Info:" . "<br>";
print_r(urldecode($params['http']['content']));
echo "<br><br>" . "Response:" . "<br>";

//print the response to screen for testing purposes
    If ( $kArray["responseEnvelope.ack"] == "Success") 
    {

         foreach ($kArray as $key =>$value)
         {
          echo $key . ": " .$value . "<br/>";
         }
    }
    else 
    {
        foreach ($kArray as $key =>$value)
        {
        echo $key . ": " .$value . "<br/>";
        }       
    }

 }

catch(Exception $e) 
{
    echo "Message: ||" .$e->getMessage()."||";
}

echo "<br>";  
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用php api检查电子邮件或手机paypal帐户状态? 的相关文章

  • PHP - Filter_var 替代方案?

    我构建了一个 php 脚本来输出以表单形式发布的数据 但遇到了问题 网站将运行的服务器运行 PHP 5 1 6 此版本的 PHP 不支持 filter var 我需要知道短期内的替代方案 最好是昨天 但在 Google 或 Stack Ov
  • 为什么我不能在 TCPDF 表中使用 č,ć,đ 图表?

    我正在为我的网站构建一个 tcpdf 文件 该 tcpdf 文件中有一个包含一些数据的表格 但我无法使该章程正常工作 对于编码 我使用 windows 1250 宪章女巫不起作用 我已经尝试过 utf 8 但仍然没有得到这个章程 tcpdf
  • 从 octobercms 中的非 ajax 表单获取输入值

    我正在尝试构建一个简单的搜索功能 下面是我的搜索表格
  • Yii2 异常:ApcCache 需要加载 PHP apc 扩展

    在高级模板前端的主配置中配置缓存组件时 我收到异常 在我的 php ini 上启用了扩展 rsults 如何解决此问题 前端 config main php cache gt class gt yii caching ApcCache ke
  • .htaccess 异常导致主目录出现问题

    这是我的目录结构 localhost or livehost app bootstrap public vendor code demo 这是我的 htaccess
  • PHP 开发相当于 Mongrel/Webrick 吗?

    PHP 开发中是否有与 Rails 开发期间使用 Mongrel Webrick 等效的方法 我通常在端口 3000 上使用 Mongrel 在开发过程中为我的 Rails 应用程序提供服务 我从事 PHP 开发已经有几年了 据我所知 方法
  • 通过 facebook graph API 检索 facebook 用户的邮政编码

    我正在尝试使用 facebook graph API 检索用户的邮政编码 我正在使用以下代码 代码在php ini中 facebook new Facebook array appId gt APP ID secret gt APP SEC
  • 使用先前的反向引用作为命名捕获组的名称

    有没有办法使用对先前捕获组的反向引用作为捕获组的名称命名捕获组 这可能不可能 如果不可能 那么这就是一个有效的答案 下列 data description some description preg match data matches p
  • 如何阻止直接访问我的 JavaScript 文件?

    我使用 Minify 来缩小并缓存所有脚本请求 我只希望我的用户能够访问 JavaScript 文件的缩小版本 缩小位于www example com min我的脚本位于www example com scripts 如何阻止直接访问doc
  • 如何在 PHP 中使用 cURL 发出同时包含 GET 和 POST 参数的请求?

    其他人已经问过如何从 perl java bash 等执行此操作 但我需要在 PHP 中执行此操作 并且我没有看到任何已提出的专门与 PHP 相关的问题 或包含 PHP 的答案 My code ch curl init url curl s
  • 如何解码 eval( gzinflate( base64_decode(

    我已将此代码注入到我的网站中 如何解码尾随字符串 我需要知道发生了什么以及其背后的代码是什么 这应该输出将被执行的代码eval 我希望这就是您正在寻找的
  • 如何在 yii2 中使用两个不同的模型登录或切换身份类别?

    我想允许用户从两个不同的模型登录 配置文件 user gt identityClass gt app models User one more class here enableAutoLogin gt false authTimeout
  • fgetcsv 在特定行打开?

    有没有办法使用 fgetcsv 在特定行上打开 我有一个非常大的 csv 想通过 ajax 一次运行大约 100 行 我可以轻松停止 while 循环 但如何在特定行上打开 或者这是不可能的 从第 100 行开始读取没有简单的方法 但您可以
  • 在库的公共接口中使用 boost::shared_ptr

    我们有一个 C 库 提供给多个不同的客户 最近 我们从在公共接口中使用原始指针改为使用 boost sharedptr 正如您可能猜到的那样 这提供了巨大的好处 因为现在客户不再需要担心谁需要删除什么以及何时删除 当我们进行切换时 我相信这
  • postgreSql 中特定时间后表更新

    我已经在 postgres 中创建了表 现在我想在特定时间 例如 1 小时 后更新一行 我看到很多问题 例如 https dba stackexchange com questions 56424 column auto updated a
  • MySQL PHP邮政编码比较具体距离

    我试图找出比较一个邮政编码 用户提供的 和一大堆其他邮政编码 现在大约有 200 个邮政编码 之间的距离的最有效方法 相对于加载时间 但它会随着时间的推移而增加 我不需要任何精确的东西 只是在球场上 我下载了整个美国的邮政编码 csv 文件
  • 如何在 OS X 上使用 OpenSSL 1.0.1 编译 PHP 5.5.19

    我已经安装了 OpenSSL 1 0 1j usr local ssl现在我尝试使用此版本的 OpenSSL 编译 PHP 5 5 19 这是我的配置过程 export CFLAGS arch x86 64 export CXXFLAGS
  • Sonata DateTimePickerType 类默认日期显示错误的日期时间格式

    我陷入困境 我不知道如何使用 sonata DateTimePickerType 类正确设置默认日期和时间 我尝试了不同的方法 但到目前为止 没有一种方法没有帮助 在下面的截图中 help 键显示正确的日期和时间 但是当我使用 dp 默认日
  • SoftLayer_Account::getOperatingSystemReloadImages

    我想在 OSReload 期间使用 API 获取可用操作系统列表 我发现提到了 SoftLayer Account getOperatingSystemReloadImages 方法 但找不到该方法的用法 谁能帮我解决这个问题 谢谢 我找不
  • Laravel $request->file() 返回 null

    尝试在后端使用 Laravel 上传文件时遇到问题 Issue Laravel request gt file 方法返回 null Setup 我使用以下方法构建了一个 AJAX 请求超级代理人 https github com visio

随机推荐