GetExpressCheckoutDetailsRequest = $getExpressCheckoutDetailsRequest; $paypalService = new PayPalAPIInterfaceServiceService(); try { /* wrap API method calls on the service object with a try catch */ $getECResponse = $paypalService->GetExpressCheckoutDetails($getExpressCheckoutReq); } catch (Exception $ex) { include_once("error.php"); exit; } //---------------------------------------------------------------------------- $tabTotal = fxTotalPanier($_SESSION['no_panier'], $strLangue); $orderTotal = new BasicAmountType(); $orderTotal->currencyID = 'CAD'; $orderTotal->value = $tabTotal['total']; $paymentDetails= new PaymentDetailsType(); $paymentDetails->OrderTotal = $orderTotal; /* if (isset($_REQUEST['notifyURL'])) { $paymentDetails->NotifyURL = $_REQUEST['notifyURL']; } */ $DoECRequestDetails = new DoExpressCheckoutPaymentRequestDetailsType(); $DoECRequestDetails->PayerID = $payerId; $DoECRequestDetails->Token = $token; $DoECRequestDetails->PaymentAction = $paymentAction; $DoECRequestDetails->PaymentDetails[0] = $paymentDetails; $DoECRequest = new DoExpressCheckoutPaymentRequestType(); $DoECRequest->DoExpressCheckoutPaymentRequestDetails = $DoECRequestDetails; $DoECReq = new DoExpressCheckoutPaymentReq(); $DoECReq->DoExpressCheckoutPaymentRequest = $DoECRequest; try { /* wrap API method calls on the service object with a try catch */ $DoECResponse = $paypalService->DoExpressCheckoutPayment($DoECReq); } catch (Exception $ex) { include_once("error.php"); exit; } if ($_SESSION['lang'] == 'fr') $strPage = 'panier'; else $strPage = 'cart'; if (isset($DoECResponse)) { /* echo "
| Ack : | $DoECResponse->Ack |
| TransactionID : | ". $DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->TransactionID." |
"; print_r($DoECResponse); echo ""; */ $strErrorLog = print_r($DoECResponse, true); if (isset($DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo)) { // sauvegarder les infos dans la bdd if ($_SESSION['lang'] == 'fr') $strResultat = 'APPROUVEE - MERCI'; else $strResultat = 'APPROVED - THANK YOU'; $sqlUpdate = "UPDATE inscriptions_panier_acheteurs SET receipt_text = '" . $strResultat . "', token = '" . $token . "', PayerID = '" . $payerId . "', TransactionID = '" . $DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->TransactionID . "', pai_id = 1, ach_error_log = '" . $objDatabase->fxEscape($strErrorLog) . "' WHERE no_panie$objDatabase '" . $objDatabase->fxEscape($_SESSION['no_panier']) . "'$objDatabase $qryUpdate = $objDatabase->fxQuery($sqlUpdate); header('Location: ' . $vDomaine . '/' . $strPage . '/resultat/' . $_SESSION['eve_label_url'] . '?ResponseFile=' . $DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->TransactionID . '&p=success'); exit; } else { // créer un numéro de transaction $strTransaction = uniqid('trx_'); $sqlUpdate = "UPDATE inscriptions_panier_acheteurs SET receipt_text = '', token = '', PayerID = '', TransactionID = '" . $strTransaction $objDatabase', ach_error_log = '" . $objDatabase->fxEscape($strEr$objDatabaseLog) . "' WHERE no_panier = '" . $objDatabase->fxEscape($$objDatabaseSSION['no_panier']) . "'"; $qryUpdate = $objDatabase->fxQuery($sqlUpdate); fxcreer_log("ERREUR DE PAIMENT: no_panier = :" . $_SESSION['no_panier'] . "\n" . $strErrorLog); header('Location: ' . $vDomaine . '/' . $strPage . '/resultat/' . $_SESSION['eve_label_url'] . '?p=error&ResponseFile=' . $strTransaction); exit; } } if ($strLangue == 'fr') $_SESSION['msg'] = 'e118'; else $_SESSION['msg'] = 'e518'; header('Location: ' . $vDomaine . '/' . $strPage . '/checkout/' . $_SESSION['eve_label_url'] ); exit; //require_once '../Response.php'; ?>