如何使用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 回显代码不起作用

    这是我的 html 和 php 脚本 h1 Bob s Auto Parts h1 table width 100 tr tr table 为什么这个输出会出现一个 gt 我希望它是 这有效 仅有的 这是输出 鲍勃的汽车零件 鲍勃
  • 尝试使用 php 发送 POST 请求,无论我做什么,我都会收到“HTTP ERROR 500”

    为了发出 HTTP 请求 有人建议我尝试使用 PHP 并给了我一段代码 url https example com dashboard api data array to gt PHONE NUMBER from gt SENDER ID
  • php源代码到PO文件生成器

    我必须将我的所有回显 打印字符串转换为PHP源代码代码文件到PO file 为了语言翻译 有批次吗对流器可用于相同的 我如何做到这一点 make gettext在您的服务器上运行 setup a 翻译适配器 例如带有 gettext 适配器
  • laravel - 使用请求类或输入类

    在宁静的控制器中 我应该使用哪个类来获取传递的变量 member gt email Input get email or member gt email Request get email 两种选择都适合我 但有什么区别 Input get
  • PHP 无法打开流:是一个目录

    非常简单的 PHP 脚本 我在我亲自设置的 Ubuntu Web 服务器上的 EE 模板中运行 我知道这与权限有关 并且我已经将我尝试写入的目录的所有者更改为 Apache 用户 我得到的错误是 遇到 PHP 错误 严重性 警告 消息 fi
  • 使用 PHP Selenium Webdriver 单击下拉菜单中的选项?

    我正在使用 PHP Selenium Webdriver 包装器Facebook https github com facebook php webdriver 任何人都可以给我一个如何单击或从选择下拉菜单中选择选项的示例吗 我已经尝试过这
  • 从类似 cronjob 的语法创建“下次运行时间”日期

    在我正在创建的应用程序中 用户可以安排重复任务 生成间隔模式的简单值是 Minute 0 59 90 each minute Hour 0 23 90 each hour Day of month 1 31 90 each day of m
  • Google Cloud SQL 上的故障转移如何运作?

    我打算将 PHP 应用程序 从 Google Cloud Platform 外部的服务器 连接到 Google Cloud SQL 我想知道如何设计应用程序以正确地对其数据库进行故障转移 根据manual https cloud googl
  • 如何防止在 PHP 中使用超出“使用”范围的特征方法

    我想知道是否有任何方法可以防止在 PHP 的任何类上下文之外使用特征方法 让我用一个简短的例子来解释我想要什么 这是我当前的代码 File MyFunctions php trait MyFunctions function hello w
  • 获取字符串中的最后一个整数

    我需要隔离包含多个整数的字符串中最新出现的整数 我怎样才能得到23代替1 for lastnum1 text 1 out of 23 lastnum1 this gt getEval eregi replace out of text 你可
  • 如何纠正这个非法字符串偏移?

    我收到此错误 警告 第 32 行 home mysite public html wp content themes evento lib php extra class php 中的非法字符串偏移 type 我意识到文件中的这部分代码是错
  • Mysqli 更新抛出 Call to a member function bind_param() 错误[重复]

    这个问题在这里已经有答案了 我有一个 70 80 字段表单 需要插入到表中 因此我首先根据表单中的输入名称在数据库中创建了一个表 而不是手动创建一个巨大的插入语句 这是我使用的代码创建 更改表 function createTable ar
  • PHP 扩展开发入门 [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 请推荐有关 PHP 低 级 modules 编程接口的帮助文章或教程 搜索我的书签 我发现的唯一链接是
  • PHP print_r() 中 _r 的含义是什么?

    我见过这个答案 https stackoverflow com questions 13103410 what does r suffix mean就这样 但我不确定它对于 PHP 是否相同 如果是 可重入的含义是什么 From PHP n
  • 使用 json_encode() 函数在 PHP 数组中生成 JSON 键值对

    我正在尝试以特定语法获取 JSON 输出 这是我的代码 ss array 1 jpg 2 jpg dates array eu gt 59 99 us gt 39 99 array1 array name gt game1 publishe
  • Ebay api GetSellerList,解析响应 XML

    我正在使用 eBay 交易 api 来获取当前列出的卖家股票 我正在使用 GetSellerList 调用 我在解析 xml 时遇到问题 然后将其插入到网站商店中 这是 xml 请求
  • PHP 中的引用

    我正在编写一个自定义博客引擎 并且希望拥有类似于 Wordpress 的引用 我可以查看 WordPress 源代码 但我真的更喜欢某种教程 但到目前为止我还没有找到 有没有关于在 PHP5 中实现 trackbacks 或 pingbac
  • 如何删除文件

    我们有一个脚本 scripts ourscript php和一个文件 media movie1 flv 当我们运行时 我们如何删除这个文件ourscript php Using unlink http php net manual en f
  • phpActiveRecord 日期时间格式不正确

    当尝试使用 phpActiveRecord 在表中创建记录时 出现以下错误 Invalid datetime format 1292 Incorrect datetime value 2013 06 20 11 59 08 PDT for
  • ZF3/2 - 如何捕获 EVENT_DISPATCH 侦听器中引发的异常?

    有什么方法可以在 EVENT DISPATCH 监听器中抛出异常吗 class Module public function onBootstrap EventInterface event application event gt get

随机推荐