alpha_full/pages/panier/payPlug/modePaie.formPayPlug.appel.php
2026-04-06 22:58:51 +02:00

60 lines
1.9 KiB
PHP
Executable File

<?php
$nomFicAppelant = basename(__FILE__);
require_once('vendor/payplug/payplug-php/lib/init.php');
\Payplug\Payplug::init(array(
'secretKey' => $privateSecretPayPlug,
'apiVersion' => '2019-08-06',
));
// ---------------------------------------------------
// Flag edt : ajouter le code language dans la table pour pouvoir boucler dessus
// ---------------------------------------------------
if ($lg=="ENG") {$language="en";}
else {$language="fr";}
$return_url= $_SESSION['server']. '/recap-paiement-faireMajRecap-1';
// ---------------------------------------------------
// Classe paiement
// ---------------------------------------------------
$payment = \Payplug\Payment::create(array(
'amount' => $amount,
'currency' => 'EUR',
'billing' => array(
'title' => $civFacLib,
'first_name' => $nom,
'last_name' => $prenom,
'email' => $idMail,
'address1' => $adresse,
'postcode' => $codePost,
'city' => $ville,
'country' => $codeIsoPaysFac,
'language' => $language
),
'shipping' => array(
'title' => $civLivLib,
'first_name' => $nomLiv,
'last_name' => $prenomLiv,
'email' => $idMail,
'address1' => $adrLiv. ' ' .$adrLiv2,
'postcode' => $codePostLiv,
'city' => $villeLiv,
'country' => $codeIsoPaysLib,
'language' => $language,
'delivery_type' => 'BILLING'
),
'hosted_payment' => array(
'return_url' => $return_url,
'cancel_url' => $_SESSION['server']. '/recap-paiement-faireMajRecap-0'
),
'notification_url' => $_SESSION['server']. '/recap-panier',
'metadata' => array(
'customer_id' => $customer_id
)
));
$payment_url = $payment->hosted_payment->payment_url;
$payment_id = $payment->id;
if (isset($debug[1]) && $debug[1] == '1' ) echo $payment_url;
?>