Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ved21212's avatar

Stripe Integration error

Hello Team, I am trying to integrate stripe in my project but end up with this error from javascript:

    Uncaught (in promise) ReferenceError: stripeTokenHandler is not defined
    at stripe-payment:116
(anonymous) @ stripe-payment:116
Promise.then (async)
(anonymous) @ stripe-payment:109

Can anyone guide me how to solve this error?

0 likes
1 reply
VinayKesharwani's avatar

Looks like you haven't defined callback function stripeTokenHandler. Here is a sample:

checkout(){
    Stripe.setPublishableKey('your_publishable_key');
    Stripe.card.createToken({
        number: this.cardNumber,
        cvc: this.cvc,
        exp_month: this.month,
        exp_year: this.year
    }, this.stripeTokenHandler);
},
stripeTokenHandler(status, response) {
    // validate payment
}

Please or to participate in this conversation.