php - 如何停止使用自适应支付对我的 Paypal 账户进行身份验证?

标签 php soap paypal

通过 Pay 方法使用自适应支付我设法让脚本工作,用户可以通过 php 将钱从我的帐户存入他们的帐户,但我必须输入我的密码,即使它使用我的 api 凭据。我怎样才能阻止它每次都询问我的密码?这是我的代码:

<?php

require_once '../../../lib/AdaptivePayments.php';
require_once 'web_constants.php';

session_start();

            try {


                   $serverName = $_SERVER['SERVER_NAME'];
                   $serverPort = $_SERVER['SERVER_PORT'];
                                                                            $url=dirname('http://'.$serverName.':'.$serverPort.$_SERVER['REQUEST_URI']);

                   $returnURL = $url."/PaymentDetails.php";
                   $cancelURL = $url. "/SetPay.php" ;
                   $currencyCode="USD";  //$_REQUEST['currencyCode'];
                   $email="qwom_1315508825_biz@btinternet.com";
                   $preapprovalKey = '';    
                   $requested='';
                   $receiverEmail='';
                   $amount='';
                   $count= count($_POST['receiveremail']);


                    //pay details//
                    $payRequest = new PayRequest();
                    $payRequest->actionType = "PAY";
                    $payRequest->currencyCode = "USD";

                    $receiver1 = new receiver();
                    $receiver1->email = "cam_1315509411_per@btinternet.com";
                    $receiver1->amount = "5.00";
                    $payRequest->receiverList = new ReceiverList();
                    $payRequest->receiverList = array($receiver1);

                    $payRequest->returnUrl = $returnURL;
                    $payRequest->senderEmail = "qwom_1315508825_biz@btinternet.com";
                    $payRequest->feesPayer = "SENDER";
                    $payRequest->cancelUrl = $cancelURL;

                    $payRequest->requestEnvelope = new RequestEnvelope();
                    $payRequest->requestEnvelope->errorLanguage = "en_US";
                    $payRequest->requestEnvelope->detailLevel = "ReturnAll";
                    //end pay details//



                   $ap = new AdaptivePayments();
                   $response=$ap->Pay($payRequest);

                   if(strtoupper($ap->isSuccess) == 'FAILURE')
                    {
                        $_SESSION['FAULTMSG']=$ap->getLastError();
                        $location = "APIError.php";
                        header("Location: $location");

                    }
                    else
                    {
                        $_SESSION['payKey'] = $response->payKey;
                        if($response->paymentExecStatus == "COMPLETED")
                        {
                            $location = "PaymentDetails.php";
                            header("Location: $location");
                        }
                        else
                        {
                            /*$token = $response->payKey;
                            $payPalURL = PAYPAL_REDIRECT_URL.'_ap-payment&paykey='.$token;
                            header("Location: ".$payPalURL);*/
                            echo $response->paymentExecStatus;
                        }
                    }
            }
            catch(Exception $ex) {

                $fault = new FaultMessage();
                $errorData = new ErrorData();
                $errorData->errorId = $ex->getFile() ;
                $errorData->message = $ex->getMessage();
                $fault->error = $errorData;
                $_SESSION['FAULTMSG']=$fault;
                $location = "APIError.php";
                header("Location: $location");
            }

?>

它使用 Adaptive Payments Soap API。凭据在包含的文件中。

最佳答案

这是预期的功能。 由于您使用的是 Pay 方法,它自然会假定这是正常交易而不是“存款”。

您需要查看 PayPal MassPay API。
参见 https://www.x.com/developers/paypal/products/mass-pay以及https://www.x.com/developers/paypal/documentation-tools/api/masspay-api-nvp对于 NVP API 文档。

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code 上还有一些示例代码(php sample here)

关于php - 如何停止使用自适应支付对我的 Paypal 账户进行身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7548198/

相关文章:

php - 使用 paypal 沙箱 ipn 模拟器时调试 ipn.php

php - 在 PHP 中轻松解析持续时间

Android 通过 ksoap2 2.5.8 通过 Https 发送 SOAP 对象

php - wordpress 高级自定义字段和 polylang 集成

php - 使用 mysql DATE_FORMAT 时出现语法错误

wcf - WCF 服务的 REST/SOAP 端点

python - 在 Python 中使用 Zimbra SOAP API

javascript - PayPal Oauth 上的 return_uri 无效

paypal - 如何处理取消的定期付款

php - 如何包含或引导 paypal-core-sdk php