SyntaxError: missing variable name
Bonjour,je suis en train d'intégrer stripe dans mon forumulaire mais lorsque regarde la console sur Firefox, j'ai ce message d'erreurs:
Citation:
SyntaxError: missing variable name
J'ai longtemos cherhcé (plusieurrs jours) la variable n'est pas déclaré, voici le début du code javascript, placé arpès le code html:
Code:
1 2 3 4 5 6 7 8 9
| var stripe = Stripe('changer clé :-> pk_test_Z7WCo5oUXnhfCMMKeEh49Tds00TYAWyZ8h');
var elements = stripe.elements();
var card = elements.create('card');
card.mount('#card-element');
var promise = stripe.createToken(card);
promise.then(function(result) {
// result.token is the card token.
}); |
Comment puis-je déclarer la variable stripe?
Merci beaucoup
Undefined index: stripeToken
javatwister:Merci en effet, stripe et Stipe sont deux fonction différente..Merci
Mais maintenant , il m'affiche ce message:
Undefined index: stripeToken
Pour ce:
Code:
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
| <?php
$stripe = $_POST['stripeToken'];
$email = $_POST['email'];
$Prénom = $_POST['Prénom'];
$adresse_de_livraison = $_POST['adresse_de_livraison'];
$Ville_et_code_postal = $_POST['Ville_et_code_postal'];
if (filter_var(!empty($token))) {
$ch = curl_init();
$data = [
'source' => $token,
'description' => $Prénom, $adresse_de_livraison, $Ville_et_code_postal,
'email' => $email
];
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.stripe.com/v1/customers',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'sk_test_T5KIwwJ6gPkZ0Edsdv9vKLD0008rUS4M7C',
CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
CURLOPT_POSTFIELDS => http_build_query($data)
]);
$response = json_decode(curl_exec($ch));
curl_close($ch);
var_dump($response);
die();
}
?> |