将自适应付款与付费方式一起使用我设法让一个脚本工作,用户可以通过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");
}
?>
它使用自适应付款肥皂API。凭据位于包含的文件中。
答案 0 :(得分:0)
这是预期的功能。 由于您使用的是Pay方法,因此它自然会假定它是正常的交易而不是“存款”。
您想要查看PayPal MassPay API 有关NVP API文档,请参阅https://www.x.com/developers/paypal/products/mass-pay以及https://www.x.com/developers/paypal/documentation-tools/api/masspay-api-nvp。
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code (php sample here)
还有一些示例代码