我已经建立了自己的Paypal Pro系统但他不工作我无法访问模板但NVP ACK成功。 我试图改变编码但没有改变。我得到的唯一的事情是
无法处理您的付款。请直接与商家联系。我的代码是:
session_start();
$total = 0;
$total = $_SESSION['navig']->commande->total;
$total -= $_SESSION["navig"]->commande->remise;
// R?f?rence
$Reference_Cde = urlencode($_SESSION['navig']->commande->transaction);
// Montant
$Montant = $total;
// Récupération de l'adresse de payement
$server = $serveur_api;
$version = "87.0";
$method = "BMCreateButton";
$user = $username_api;
$pwd = $password_api;
$signature = $key_api;
$buttoncode = "TOKEN";
$buttontype = "PAYMENT";
$data = array(
"PAYMENTACTION" => urlencode("sale"),
"AMOUNT" => urlencode(round($Montant, 2)),
"TAX" => urlencode("19.6"),
"FIRST_NAME" => urlencode($_SESSION["navig"]->client->prenom),
"LASR_NAME" => urlencode($_SESSION["navig"]->client->nom),
"ADDRESS1" => urlencode($_SESSION["navig"]->client->adresse1),
"ADDRESS2" => urlencode($_SESSION["navig"]->client->adresse2),
"CITY" => urlencode($_SESSION["navig"]->client->ville),
"ZIP" => urlencode($_SESSION["navig"]->client->cpostal),
"EMAIL" => urlencode($_SESSION["navig"]->client->email),
"SHIPPING_1" => urlencode($_SESSION["navig"]->commande->port),
"CURRENCY_CODE" => urlencode($Devise),
"PAYER_ID" => urlencode($_SESSION["navig"]->client->id),
"PAYER_EMAIL" => urlencode($_SESSION["navig"]->client->email),
"RETURN" => urlencode($retourok),
"NOTIFY_URL" => urlencode($confirm),
"CANCEL_RETURN" => urlencode($retournok),
"INVOICE" => urlencode($Reference_Cde)
);
$request[] = "VERSION=".$version;
$request[] = "METHOD=".$method;
$request[] = "USER=".$user;
$request[] = "PWD=".$pwd;
$request[] = "SIGNATURE=".$signature;
$request[] = "BUTTONCODE=".$buttoncode;
$request[] = "BUTTONTYPE=".$buttontype;
$i = 0;
foreach ($data as $key => $value) {
$request[] = "L_BUTTONVAR".$i."=".$key."=".$value;
$i++;
}
$requestcurl = "";
foreach ($request as $data => $value) {
$requestcurl .= $value . "&";
}
$requestcurl = substr($requestcurl, 0, -1);
$requestcurl = str_replace(" ", "+", $requestcurl);
$requestcurl = utf8_encode($requestcurl);
$url = parse_url($serveur_api);
$reponse = "";
$fp = fsockopen("ssl://".$url['host'],"443",$err_num,$err_str,30);
if(!$fp) {
return false;
} else {
fputs($fp, "POST $url[path] HTTP/1.1\r\n");
fputs($fp, "Host: $url[host]\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ".strlen($requestcurl)."\r\n");
fputs($fp, "Charset: utf-8\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $requestcurl . "\r\n\r\n");
while(!feof($fp))
$reponse .= fgets($fp, 4096);
fclose($fp);
};
$rep = explode("&", $reponse);
$rep = explode("=", $rep[1]);
$result = urldecode($rep[1]);
header("Location:".$result);
答案 0 :(得分:0)
我找到了该问题的解决方案我将“AMOUNT”替换为“subtotal”,并且我将数据数组中的所有小写替换为小写。
亲切