Bonjour, je rencontre un problème avec mon panier qui doit effectuer une redirection vers paypal, malheuresement paypal me retourne une erreur de " Order ammount is missing " alors que le champs est bien entré et surtout que ce champs fonctionnait juste avant l'implantation de paypal, paypal n'est censé que l'utiliser mais c'est comme si l'info ne lui remontée pas.
Partie concernée ligne 92
Merci pour votre aide !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174 <?php require_once('includes/header.php'); require_once('includes/sidebar.php'); require_once('includes/functions_panier.php'); require_once('includes/paypal.php'); $erreur = false; $action = (isset($_POST['action'])?$_POST['action']:(isset($_GET['action'])?$_GET['action']:null)); if($action!==null){ if(!in_array($action, array('ajout','suppression','refresh'))) $erreur = true; $l = (isset($_POST['l'])?$_POST['l']:(isset($_GET['l'])?$_GET['l']:null)); $q = (isset($_POST['q'])?$_POST['q']:(isset($_GET['q'])?$_GET['q']:null)); $p = (isset($_POST['p'])?$_POST['p']:(isset($_GET['p'])?$_GET['p']:null)); $l = preg_replace('#\v#', '', $l); $p = floatval($p); if(is_array($q)){ $QteArticle = array(); $i = 0; foreach($q as $contenu){ $QteArticle[$i++] = intval($contenu); } }else{ $q = intval($q); } } if(!$erreur){ switch ($action) { Case "ajout": ajouterArticle($l,$q,$p); break; Case "suppression": supprimerArticle($l); break; Case "refresh": for($i = 0; $i<count($QteArticle);$i++){ modifierQTeArticle($_SESSION['panier']['libelleProduit'][$i], round($QteArticle[$i])); break; } Defaults: break; } } ?> <form method="post" action=""> <table width="400"> <tr> <td colspan="4">Votre panier</td> </tr> <tr> <td>Libellé produit</td> <td>Prix unitaire</td> <td>Quantité</td> <td> TVA </td> <td>Action</td> </tr> <?php if(isset($_GET['deletepanier']) && $_GET['deletepanier'] == true){ supprimerPanier(); } if(creationPanier()){ $nbProduits = count($_SESSION['panier']['libelleProduit']); if($nbProduits<=0){ echo'<br/><p style="font-size:20px; color:Red;">Oops, panier vide !<br/> Le passage à la caisse est plus tard ;) !'; }else{ $total = MontantGlobal(); $totaltva = MontantGlobalTVA(); $shipping = CalculFraisPorts(); $paypal = new Paypal (); $params = array ( 'RETURNURL' => 'http://127.0.0.1/boutique/process.php', 'CANCELURL' => 'http://127.0.0.1/boutique/cancel.php', 'PAYEMENTREQUEST_0_AMT' => $totaltva + $shipping, 'PAYEMENTREQUEST_0_CURRENCYCODE' => 'EUR', 'PAYEMENTREQUEST_0_SHIPPINGAMT' => $shipping, 'PAYEMENTREQUEST_0_ITEMAMT' => $totaltva ); $response = $paypal->request('SetExpressCheckout', $params); if($response){ $paypal = 'https://sandbox.paypal.com/webscr?cmd=_express-checkout&useraction=commit&token='.$response['TOKEN'].''; }else{ var_dump($paypal->errors); die('Erreur'); } for($i=0;$i<$nbProduits; $i++){ ?> <tr> <td><?php echo $_SESSION['panier']['libelleProduit'][$i];?></td> <td><?php echo $_SESSION['panier']['prixProduit'][$i];?> <td><input name="q[]" value="<?php echo $_SESSION['panier']['qteProduit'][$i]; ?>" size="5"/></td> </td> <td> <?php echo $_SESSION['panier']['tva']." % "; ?> </td> <td> <br/><a href="panier.php?action=suppression&l=<?php echo rawurlencode($_SESSION['panier']['libelleProduit'][$i]); ?>">Supprimer</a></td> </tr> <?php } ?> <tr> <td colspan="2"><br/> <p> Total : <?php echo $total.""; ?></p> <p> Total TVA : <?php echo $totaltva."";?></p> <p> Tarif FDP : <?php echo $shipping."";?></p> <a href="<?php echo $paypal; ?>">Payer la commande </a> </td> </tr> <tr> <td colspan="4"> <input type="submit" value="Rafraichir"/> <input type="hidden" name="action" value="refresh"/> <a href="?deletepanier=true">Supprimer mon panier </a> </td> </tr> <?php } } ?> </table> </form> <?php require_once('includes/footer.php'); ?>
Partager