When using Stripe in live mode I get this PHP error:
No such token tok_fgfhn.. a similar object exists in test mode, but a live mode key was used to make this request
Everything works well in Stripe test mode, and and I've switched to a live API key.
I create a new customer like this:
$token = $_POST['stripeToken']; $email = $_POST['email']; $customer = \Stripe\Customer::create(array( 'email' => $email, 'card' => $token )); //charge for user ads $charge = \Stripe\Charge::create(array( 'customer' => $customer->id, 'amount' => $amount, 'currency' => 'eur' ));
I've tested many hours but I still get this error. How can I fix it?
Go to Portal Settings > Payment Settings. Scroll down to Stripe Modes and ensure that the settings are set to test by clicking on the Test Mode button.
When you're done testing, remember to deactivate Test Mode in Stripe before allowing users to submit payments in your form. You can do this by going to WPForms » Settings » Payments, as in the previous step. To enable Live Mode, scroll to the Stripe section and deselect the Test Mode checkbox.
It sounds like you're trying to charge a customer who exists on your test account, not on your live account. Make sure you are making a new customer with your live keys and using their token to create the charge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With