#kyrn0zofficiel

1 messages · Page 1 of 1 (latest)

ashen scaffoldBOT
barren reef
#

👋 happy to help

#

you can't use a token that was created in test mode with live mode requests

#

you need to create a new token

#

but in all cases, you shouldn't be using tokens

little marten
#

it's the way i do my call :

                if (result.error) {
                    var errorElement = document.getElementById('card-errors');
                    errorElement.textContent = result.error.message;
                } else {
                    var amount = nombrePersonnes * 6500;
                    var formData = {
                        date: formattedDateTime,
                        amount: amount,
                        currency: 'eur',
                        source: result.token.id,
                        description: 'Paiement de ' + name + ' pour ' + nombrePersonnes + ' personne(s)',
                        name: name,
                        email: email
                    };
                    fetch('https://api.wdj2024.vie-extraordinaire.com/charge', {
                            method: 'POST',
                            headers: {
                                'Content-Type': 'application/json',
                            },
                            body: JSON.stringify(formData),
                        })
                        .then(response => response.json())
                        .then(data => {
                            if (data.success) {
                                sendFormData(personneData);
                                alert('Paiement réussi!');
                                window.location.href = '/';
                            } else {
                                alert('Erreur lors du paiement: ' + data.error);
                            }
                        })
                        .catch(error => {
                            console.error('Erreur lors de la soumission du formulaire:', error);
                            alert('Une erreur s\'est produite. Veuillez réessayer plus tard.');
                        });
                }
            });
        }```
chilly horizon
#

hi! I'm taking over this thread.

#

the error you shared is pretty clear: you are trying to use a Token created in live move with a test mode key, which can't work. It means you forgot to change some of your keys when switching from test mode to live mode.

#

but as mentioned above, you shouldn't use Tokens at all, they are an old integration