Stripe: No such token.. a similar object exists in test mode, but a live mode key was used to make this request

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.


Look into the javascript that uses test public API key to retrieve token. Change it to your live public API key.

It should be something like this

Stripe.setPublishableKey('pk_test_axEdfdasdfasfsadfsad');

You will have two different keys in your stripe account. Kindly make sure you've replace both test keys with live keys:

live sectret key: sk_live_00000000000000000000000

live publish key: pk_live_00000000000000000000000

1- Secret key will replace in all your php scripts where're charging

  \Stripe\Stripe::setApiKey("sk_live_00000000000000000000");

2- Publish key will replace in your .JS file through which you're validating your payment form this same file also creates token after successful validation. It may call stripe.js or may other name you need to locate this file it will have publish key that you need to replace from test to live:

 Stripe.setPublishableKey('pk_live_0000000000000'); //this would be publish key

            function stripeResponseHandler(status, response) { //token function
                if (response.error) {
                    // re-enable the submit button
                    $('.submit-button').removeAttr("disabled");
                    // show hidden div
                    document.getElementById('a_x200').style.display = 'block';
                    // show the errors on the form
                    $(".payment-errors").html(response.error.message);
                } else {
                    var form$ = $("#payment-form");
                    // token contains id, last4, and card type
                    var token = response['id'];
                    // insert the token into the form so it gets submitted to the server
                    form$.append("<input type='hidden' name='stripeToken' value='" + token + "' />");
                    // and submit
                    form$.get(0).submit();
                }
            }