使用Paypal进行PHP自适应支付:您的支付可以';不可能完成。请返回参与网站并重试
我正在用自适应支付实现php代码,在最后一页的交易完成后,我得到一个错误,您的支付无法完成。请返回参与网站并重试。这个代码有什么问题。这是我的密码使用Paypal进行PHP自适应支付:您的支付可以';不可能完成。请返回参与网站并重试,php,paypal,paypal-sandbox,paypal-adaptive-payments,Php,Paypal,Paypal Sandbox,Paypal Adaptive Payments,我正在用自适应支付实现php代码,在最后一页的交易完成后,我得到一个错误,您的支付无法完成。请返回参与网站并重试。这个代码有什么问题。这是我的密码 enter code here <?php //turn php errors on //ini_set("track_errors", true); //set PayPal Endpoint to sandbox $url = trim("https://svcs.sandbox.paypal.com/AdaptivePayme
enter code here
<?php
//turn php errors on
//ini_set("track_errors", true);
//set PayPal Endpoint to sandbox
$url = trim("https://svcs.sandbox.paypal.com/AdaptivePayments/Pay");
$API_UserName = "s.patel_api1.sactp.ca"; //TODO
$API_Password = "PA9YLDURHKTU52LH"; //TODO
$API_Signature = "An5ns1Kso7MWUdW4ErQKJJJ4qi4-AOPwV4AdrC6q3hsN81pmNWMXn7f-"; //TODO
$receiver_email = "rushi.mtech@gmail.com"; //TODO
$amount = 25; //TODO
//Default App ID for Sandbox
$API_AppID = "APP-80W284485P519543T";
$API_RequestFormat = "NV";
$API_ResponseFormat = "NV";
$bodyparams = array ( "requestEnvelope.errorLanguage" => "en_US",
"actionType" => "PAY",
"cancelUrl" => "http://localhost/success.php",
"returnUrl" => "http://localhost/cancel.php",
"currencyCode" => "CAD",
"receiverList.receiver.email" => $receiver_email,
"receiverList.receiver.amount" => $amount
);
// convert payload array into url encoded query string
$body_data = http_build_query($bodyparams, "", chr(38));
try
{
$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"
));
//create stream context
$ctx = stream_context_create($params);
//open the stream and send request
$fp = @fopen($url, "r", false, $ctx);
//get response
$response = stream_get_contents($fp);
//check to see if stream is open
if ($response === false) {
throw new Exception("php error message = " . "$php_errormsg");
}
//close the stream
fclose($fp);
//parse the ap key from the response
$keyArray = explode("&", $response);
foreach ($keyArray as $rVal){
list($qKey, $qVal) = explode ("=", $rVal);
$kArray[$qKey] = $qVal;
}
$rushi;
//print the response to screen for testing purposes
If ( $kArray["responseEnvelope.ack"] == "Success") {
foreach ($kArray as $key =>$value){
// echo $key . ": " .$value . "<br/>";
if($key == "payKey")
{
$rushi = $value;
echo $rushi;
}
}
}
else {
echo 'ERROR Code: ' . $kArray["error(0).errorId"] . " <br/>";
echo 'ERROR Message: ' . urldecode($kArray["error(0).message"]) . " <br/>";
}
}
catch(Exception $e) {
echo "Message: ||" .$e->getMessage()."||";
}
?>
在此处输入代码
加上我的embaded html从请指导我