title: Stripe Custom Field
body: <p>I have a problem with Stripe. Everything works fine when I write in Cardnumber, CVC etc.</p>
  
  <p>But I need to add a custom field so it can work when I write $_POST['ImeiNum'] in charge.php.</p>
  
  <p>Here's my code for the HTML and JQUERY (index.html)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          // this identifies your website in the createToken call below
          Stripe.setPublishableKey('pk_test_d34534');
  
  
          function processStripeResponse(status, response){
            var form = $('#payment-form&lt;?php echo $row['product_id']; ?&gt;');
  
            if(response.error){
              form.find('.errors').text(response.error.message);
              form.find('button').prop('disabled', false);
            }else{
              var token = response.id;
              form.append($('&lt;input type="hidden" name="stripeToken" /&gt;').val(token));
              form.get(0).submit();
            }
          };
  
          $(function(){
            $('#payment-form&lt;?php echo $row['product_id']; ?&gt;').submit(function(event) {
              var form = $(this);
              form.find('button').prop('disabled', true);
  
              Stripe.card.createToken(form, processStripeResponse);
  
              return false;
            });
           });
      &lt;/script&gt;
  
  
      &lt;form action="charge.php" method="POST" id="payment-form&lt;?php echo $row['product_id']; ?&gt;"&gt;
  
  
           &lt;input type="hidden" name="ImeiNum" value="0987654321"&gt; 
  
  
            &lt;div&gt;
              &lt;label for="card-number"&gt;Card Number&lt;/label&gt;
              &lt;input type="text" size="20" data-stripe="number" id="card-number" name="card-number"&gt;
            &lt;/div&gt;
  
            &lt;div&gt;
              &lt;label for="cvc"&gt;Security Code&lt;/label&gt;
              &lt;input type="text" size="4" data-stripe="cvc" id="cvc" name="cvc"&gt;
            &lt;/div&gt;
  
            &lt;div&gt;
              &lt;label&gt;Expiration (MM/YYYY)&lt;/label&gt;
              &lt;input type="text" data-stripe="exp-month" name="exp-month"&gt;
              &lt;span&gt; / &lt;/span&gt;
              &lt;input type="text" data-stripe="exp-year" name="exp-year"/&gt;
            &lt;/div&gt;
  
            &lt;input type="submit" name="pay" value="Pay"&gt;
  
         &lt;div class="errors"&gt;&lt;/div&gt;
  
      &lt;/form&gt;
  </code></pre>
  
  <p>And here is my code for PHP (charge.php)</p>
  
  <pre><code>&lt;?php
  require_once('/storage/content/88/200388/vendor/autoload.php');
  
      \Stripe\Stripe::setApiKey('pk_test_APId34534');
  
      $token = $_POST['stripeToken'];
  
      $IMEI = $_POST['ImeiNum'];
  
      try {
          $charge = \Stripe\Charge::create(array(
            "amount" =&gt; 1000,
            "currency" =&gt; "usd",
            "source" =&gt; $token,
            "description" =&gt; $email,
            "metadata" =&gt; array("IMEI" =&gt; $IMEI))
          );
  
          print_r($charge);
      }catch(\Stripe\Error\Card $e){
          echo $e-&gt;getMessage();
      }
  
  
  ?&gt;
  </code></pre>
  
  <p>How do I send a custom field to charge.php?</p>