event.reject() is not a valid function on the event object, due to outdated documentation. Remove the onClick handler, - instead use the confirmPayment() method of the elements object after fetching the payment intent's client_secret from your server.