0

私は独自の 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);
4

1 に答える 1