Pergunta

I have build my own Paypal Pro System But He Don't Work i can't access template but NVP ACK Success. i've tried to change encoding but nothing to change. The only things i get is

Unable to process your payment. Please contact the merchant directly.
My code is :

    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);

Nenhuma solução correta

Outras dicas

I've found the solution for that problem i've replace "AMOUNT" by "subtotal" and i've replace all uppercase in lowercase in the data array.

Cordially

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top