<p>Add the following hidden inputs below the <code>&lt;input type="text" data-stripe="exp" placeholder="mm / yy" id="cardExpiry"/&gt;</code> line:</p>

<pre><code>&lt;input type="hidden" name="cardExpMonth" data-stripe="exp_month"&gt;
&lt;input type="hidden" name="cardExpYear" data-stripe="exp_year"&gt;
</code></pre>

<p>The example in the documentation seems to be missing that information but you can find it in the provided templates.</p>

CC BY-SA 3.0
2017-11-22T03:16:47.737Z
2017-11-22T03:16:47.737Z
benface
<p>I created fields using Charge 2 plugin and after creating a form I getting an error </p>

<blockquote>
  <p>Missing required param: card[exp_month].</p>
</blockquote>

<pre><code> &lt;div class=""&gt;
    &lt;div class="grp-form"&gt;
        &lt;form 
              id="charge-form"
              method="post"
              action=""
              accept-charset="UTF-8"
              data-publicKey="{{ craft.charge.getPublicKey }}"&gt;


            {{ forms.hidden({ name : 'action', value: 'charge/charge' }) }}
            {{ getCsrfInput() }}

            {% set options = planAmount %}
            {{ craft.charge.setPaymentOptions(options) }}

            &lt;div class="custDet-form"&gt;
            &lt;h4&gt;Customer Details&lt;/h4&gt;

                {% include 'charge/_includes/inputs/customerDetails' %}

                {{ forms.textField({
                    name: 'fields[businessName]',
                    id: 'businessName',
                    label: 'Business Name',
                    placeholder: 'eg. My Business'
                }) }}

                {{ forms.textField({
                    name: 'fields[phoneNumber]',
                    id: 'phoneNumber',
                    label: 'Phone Number'
                }) }}

                {{ forms.textField({
                    name: 'fields[streetAddress]',
                    id: 'streetAddress',
                    label: 'Street Address'
                }) }}

                {{ forms.textField({
                    name: 'fields[city]',
                    id: 'city',
                    label: 'City'
                }) }}



                {{ forms.textField({
                    name: 'fields[postcode]',
                    id: 'postcode',
                    label: 'Post Code'
                }) }}


                &lt;div class="select-indent"&gt;
                    &lt;label for="state"&gt;State&lt;/label&gt;
                    &lt;select multiple name="fields[state][]" class="select-mult"&gt;
                        &lt;option value="NSW"&gt;NSW&lt;/option&gt;
                        &lt;option value="QLD"&gt;QLD&lt;/option&gt;
                        &lt;option value="SA"&gt;SA&lt;/option&gt;
                        &lt;option value="VIC"&gt;VIC&lt;/option&gt;
                        &lt;option value="WA"&gt;WA&lt;/option&gt;
                        &lt;option value="ACT"&gt;ACT&lt;/option&gt;
                        &lt;option value="TAS"&gt;TAS&lt;/option&gt;
                        &lt;option value="NT"&gt;NT&lt;/option&gt;
                    &lt;/select&gt;
                &lt;/div&gt;


                {% if charge is defined %}
                    {% for error in charge.getErrors('simpleText') %}
                    &lt;ul class="errors"&gt;&lt;li&gt;{{ error }}&lt;/li&gt;&lt;/ul&gt;
                    {% endfor %}
                {% endif %}


         &lt;/div&gt;

        &lt;div class="cardDet-form"&gt;
            &lt;h4&gt;Plan Details&lt;/h4&gt;
            {{ stripe.amountField({
                label: 'Amount',
                value: options,
                readonly: true
            }) }}

            &lt;h4&gt;Card Details&lt;/h4&gt;
             {% if charge is defined and charge.cardToken %}
            {# We already have the card details #}
            Pay with : {{ charge.cardType }} - {{ charge.cardLast4 }}

            &lt;input type="hidden" name="cardToken" value="{{ charge.cardToken }}" data-stripe="token"/&gt;
            &lt;input type="hidden" name="cardLast4" value="{{ charge.cardLast4 }}"/&gt;
            &lt;input type="hidden" name="cardType" value="{{ charge.cardType }}"/&gt;
            &lt;input type="hidden" name="cardName" value="{{ charge.cardName }}"/&gt;
            &lt;input type="hidden" name="cardExpMonth" value="{{ charge.cardExpMonth }}"/&gt;
            &lt;input type="hidden" name="cardExpYear" value="{{ charge.cardExpYear }}"/&gt;

          {% else %}
            &lt;label for="cardNumber"&gt;Card Number&lt;/label&gt;
            &lt;input type="text" data-stripe="number" placeholder="•••• •••• •••• ••••" id="cardNumber"/&gt;

           &lt;label for="cardExpiry"&gt;Card Expiry&lt;/label&gt;
            &lt;input type="text" data-stripe="exp" placeholder="mm / yy" id="cardExpiry"/&gt;

            &lt;label for="cardCvc"&gt;Card CVC&lt;/label&gt;
            &lt;input type="text" data-stripe="cvc" placeholder="123" id="cardCvc"/&gt;
          {% endif %}

            &lt;div id="payment-errors" class="alert alert-error"&gt;&lt;/div&gt;

            {% include 'charge/_includes/inputs/paymentButton' %}

         &lt;/div&gt;

        &lt;/form&gt;

        &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"&gt;&lt;/script&gt;
        &lt;script src="{{ resourceUrl('charge/js/stripe_v2.min.js') }}"&gt;&lt;/script&gt;
        &lt;script src="{{ resourceUrl('charge/js/jquery.charge.js') }}"&gt;&lt;/script&gt;
        &lt;script&gt;
            (function () {
            Stripe.setPublishableKey('{{ craft.charge.getPublicKey() }}');
            $(this).charge();
            })();
        &lt;/script&gt;

    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<form><craft-pro><plugin-charge><payment>
Missing required param: card[exp_month] on Charge 2
# Missing required param: card[exp_month] on Charge 2

(Asked by: username_0 on 2017-11-22)

I created fields using Charge 2 plugin and after creating a form I getting an error 

Missing required param: card[exp_month].

 
    
        


            {{ forms.hidden({ name : 'action', value: 'charge/charge' }) }}
            {{ getCsrfInput() }}

            {% set options = planAmount %}
            {{ craft.charge.setPaymentOptions(options) }}

            
            Customer Details

                {% include 'charge/_includes/inputs/customerDetails' %}

                {{ forms.textField({
                    name: 'fields[businessName]',
                    id: 'businessName',
                    label: 'Business Name',
                    placeholder: 'eg. My Business'
                }) }}

                {{ forms.textField({
                    name: 'fields[phoneNumber]',
                    id: 'phoneNumber',
                    label: 'Phone Number'
                }) }}

                {{ forms.textField({
                    name: 'fields[streetAddress]',
                    id: 'streetAddress',
                    label: 'Street Address'
                }) }}

                {{ forms.textField({
                    name: 'fields[city]',
                    id: 'city',
                    label: 'City'
                }) }}



                {{ forms.textField({
                    name: 'fields[postcode]',
                    id: 'postcode',
                    label: 'Post Code'
                }) }}


                
                    State
                    
                        NSW
                        QLD
                        SA
                        VIC
                        WA
                        ACT
                        TAS
                        NT
                    
                


                {% if charge is defined %}
                    {% for error in charge.getErrors('simpleText') %}
                    {{ error }}
                    {% endfor %}
                {% endif %}


         

        
            Plan Details
            {{ stripe.amountField({
                label: 'Amount',
                value: options,
                readonly: true
            }) }}

            Card Details
             {% if charge is defined and charge.cardToken %}
            {# We already have the card details #}
            Pay with : {{ charge.cardType }} - {{ charge.cardLast4 }}

            
            
            
            
            
            

          {% else %}
            Card Number
            

           Card Expiry
            

            Card CVC
            
          {% endif %}

            

            {% include 'charge/_includes/inputs/paymentButton' %}

**Tags:** form, craft-pro, plugin-charge, payment


---

## 1 answers

### Answer by username_1 on 2017-11-22. Score: 2

Add the following hidden inputs below the  line:



The example in the documentation seems to be missing that information but you can find it in the provided templates.


---

