How do I fire a function with Stripe JS in React?
<p>I'm working to integrate Stripe into my React build. 
I have followed the syntax for what I understand to be best practices for a form submit / tokenisation and as soon as the browser gets to the <strong>self.stripeHandler()</strong> I get an error in my console. </p>

<p>When not building in React and instead using jQuery, the <strong>stripeResponseHandler</strong> function is included as a parameter in the <strong>Stripe.card.createToken</strong> function and fires the <strong>stripeResponseHandler</strong> function with no issues.</p>

<p>Now, I am having trouble adapting the Stripe documentation to React. Any ideas? </p>

<p>I'm using using webpack to componetise the build. That would be the issue would it?</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import React from 'react';
import jQuery from 'jquery';

export default class PurchaseForm extends React.Component {

    submitFormHandler(e) {

      e.preventDefault();

      var $form = $('#payment-form');

      const self = this;

      $form.submit(function(event, self) {

        // Request a token from Stripe:
        Stripe.card.createToken({
          number: $('.card-number').val(),
          cvc: $('.card-cvc').val(),
          exp_month: $('.card-expiry-month').val(),
          exp_year: $('.card-expiry-year').val()
        }, self.stripeResponseHandler()); // Uncaught TypeError: Cannot read property 'stripeResponseHandler' of undefined

        return false;
      });

    };

    stripeResponseHandler(){

      console.log("stripeResponseHandler fired");

    };

  render(){
    return(
      &lt;div&gt;
        &lt;form onSubmit={this.submitFormHandler.bind(this}&gt;.....&lt;/form&gt;
      &lt;/div&gt;
    );  
  }
};
  
  
  </code></pre>
</div>
</div>
</p>

<p>Thank you for any help you can provide.
Moe</p>