Answers.Body: <p>After looking into the source code of the encrypt function, the <code>craft.charge.setPaymentOptions()</code> function calls <code>mcrypt_module_get_algo_key_size</code> and because my vagrant box (ubuntu 14.04) didn't have <code>php5-mcrypt</code> installed, it failed there.</p>
  
  <p>To fix it: run <code>apt-get install php5-mcrypt &amp;&amp; sudo php5enmod mcrypt</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-07T03:09:38.327Z
Answers.LastActivityDate: 2017-09-07T03:09:38.327Z
Answers.UserDisplayName: Leon Zhang
Body: <p>I just had a fresh install of Charge 2 and my Craft version is Craft CMS 2.6.2989. However as long as I have <code>{{craft.charge.setPaymentOptions()}}</code> in my template, all my form fields disappear and show up again after I remove this line.</p>
  
  <pre><code>{% extends "_layout" %}
  {% set title = "Bookings" | t %}
  
  {% set entry = craft.entries.section('bookings').first %}
  
  {% block content %}
      &lt;div class="[ grid ] island"&gt;
          &lt;div class="[ grid__item desk-seven-twelfths ]"&gt;
              {% if entry.heading | length %}
                  &lt;h1 class="brand-color"&gt;{{ entry.heading }}&lt;/h1&gt;
              {% endif %}
  
              {% if entry.featureImage | length %}
                  &lt;img src="{{ entry.featureImage.first.url('halfWidth') }}" alt="{{ entry.Title }}" class="push--bottom"&gt;
              {% endif %}
  
              {% if entry.introText | length %}
                  &lt;div class="lede"&gt;{{ entry.introText }}&lt;/div&gt;
              {% endif %}
  
              {% if entry.body | length %}
                  {% include '_partials/_body' %}
              {% endif %}
          &lt;/div&gt;
  
          &lt;div class="[ grid__item desk-one-third push--desk-one-twelfth ]"&gt;
              &lt;div class="island ui-background--light"&gt;
                  &lt;h3 class="push-half--bottom text--center ui-color--dark"&gt;{{ "Make a Payment" | t }}&lt;/h3&gt;
  
                  &lt;hr class="rule rule--double"&gt;
  
                  &lt;form id="charge-form" method="post" data-publicKey="{{ craft.charge.publicKey }}"&gt;
                      {% set chargeOptions = {'planAmount' : 99} %}
                      {{craft.charge.setPaymentOptions(chargeOptions)}}
                      &lt;input type="hidden" name="action" value="charge/charge"/&gt;
  
                      &lt;label for="customerEmail"&gt;Receipt Email&lt;/label&gt;
                      &lt;input type="text" name="customerEmail" value="{{ currentUser ? currentUser.email }}" id="customerEmail"/&gt;
  
                      &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;
                  &lt;/form&gt; 
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"&gt;&lt;/script&gt;
      {% includeJsResource('charge/js/jquery.charge.js') %}
      {% includeJsResource('charge/js/stripe_v2.min.js') %}
      {% includejs %}
          $(this).charge();
      {% endincludejs %}
  {% endblock %}
  </code></pre>
  
  <p><a href="https://i.sstatic.net/6AoyC.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6AoyC.png" alt="enter image description here"></a></p>
  
  <p>I can't see what's wrong with my setup...</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-05T04:38:33.410Z
Comments.Text: Looks like `{{craft.charge.setPaymentOptions()}}` returns a 500 and the page just half rendered, stopped at this line
Comments.UserDisplayName: Leon Zhang
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-05T05:59:25.270Z
Comments.Text: There is something wrong with function
  
   ```public function encode($arr)
      {
          return base64_encode(craft()->security->encrypt(serialize($arr)));
      }```
Comments.UserDisplayName: Leon Zhang
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-05T06:39:13.157Z
Comments.Text: Never mind, I figured out. After looking into the source code of the encrypt function, it calls `mcrypt_module_get_algo_key_size` and because my vagrant box didn't have `php5-mcrypt` installed, it failed there.
  To fix it:
  `apt-get install php5-mcrypt`
  `sudo php5enmod mcrypt`
Comments.UserDisplayName: Leon Zhang
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-09-05T18:06:47.797Z
Comments.Text: Thanks for the follow-up, Leon.  Would you mind adding that as an official answer in case it helps someone in the future?
Comments.UserDisplayName: Brad Bell
Tags: <templating><plugin-charge><stripe>
Title: Charge 2 - Stripe form fields not showing
ThreadText: # Charge 2 - Stripe form fields not showing
  
  (Asked by: username_0 on 2017-09-05)
  
  I just had a fresh install of Charge 2 and my Craft version is Craft CMS 2.6.2989. However as long as I have `{{craft.charge.setPaymentOptions()}}` in my template, all my form fields disappear and show up again after I remove this line.
  
  ```
  {% extends "_layout" %}
  {% set title = "Bookings" | t %}
  
  {% set entry = craft.entries.section('bookings').first %}
  
  {% block content %}
      <div class="[ grid ] island">
          <div class="[ grid__item desk-seven-twelfths ]">
              {% if entry.heading | length %}
                  <h1 class="brand-color">{{ entry.heading }}</h1>
              {% endif %}
  
              {% if entry.featureImage | length %}
                  <img src="{{ entry.featureImage.first.url('halfWidth') }}" alt="{{ entry.Title }}" class="push--bottom">
              {% endif %}
  
              {% if entry.introText | length %}
                  <div class="lede">{{ entry.introText }}</div>
              {% endif %}
  
              {% if entry.body | length %}
                  {% include '_partials/_body' %}
              {% endif %}
          </div>
  
          <div class="[ grid__item desk-one-third push--desk-one-twelfth ]">
              <div class="island ui-background--light">
                  <h3 class="push-half--bottom text--center ui-color--dark">{{ "Make a Payment" | t }}</h3>
  
                  <hr class="rule rule--double">
  
                  <form id="charge-form" method="post" data-publicKey="{{ craft.charge.publicKey }}">
                      {% set chargeOptions = {'planAmount' : 99} %}
                      {{craft.charge.setPaymentOptions(chargeOptions)}}
                      <input type="hidden" name="action" value="charge/charge"/>
  
                      <label for="customerEmail">Receipt Email</label>
                      <input type="text" name="customerEmail" value="{{ currentUser ? currentUser.email }}" id="customerEmail"/>
  
                      <label for="cardNumber">Card Number</label>
                      <input type="text" data-stripe="number" placeholder="•••• •••• •••• ••••" id="cardNumber"/>
  
                      <label for="cardExpiry">Card Expiry</label>
                      <input type="text" data-stripe="exp" placeholder="mm / yy" id="cardExpiry"/>
  
                      <label for="cardCvc">Card CVC</label>
                      <input type="text" data-stripe="cvc" placeholder="123" id="cardCvc"/>
                  </form> 
  
              </div>
          </div>
      </div>
      <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
      {% includeJsResource('charge/js/jquery.charge.js') %}
      {% includeJsResource('charge/js/stripe_v2.min.js') %}
      {% includejs %}
          $(this).charge();
      {% endincludejs %}
  {% endblock %}
  
  ```
  
  [![enter image description here](https://i.sstatic.net/6AoyC.png)](https://i.sstatic.net/6AoyC.png)
  
  I can't see what's wrong with my setup...
  
  **Tags:** templating, plugin-charge, stripe
  
  > **Comments:**
  > **username_0**: Looks like `{{craft.charge.setPaymentOptions()}}` returns a 500 and the page just half rendered, stopped at this line  
  > **username_0**: There is something wrong with function   ```public function encode($arr)     {         return base64_encode(craft()->security->encrypt(serialize($arr)));     }```  
  > **username_0**: Never mind, I figured out. After looking into the source code of the encrypt function, it calls `mcrypt_module_get_algo_key_size` and because my vagrant box didn't have `php5-mcrypt` installed, it failed there. To fix it: `apt-get install php5-mcrypt` `sudo php5enmod mcrypt`  
  > **username_1**: Thanks for the follow-up, username_0.  Would you mind adding that as an official answer in case it helps someone in the future?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-09-07. Score: 1 | Accepted answer
  
  After looking into the source code of the encrypt function, the `craft.charge.setPaymentOptions()` function calls `mcrypt_module_get_algo_key_size` and because my vagrant box (ubuntu 14.04) didn't have `php5-mcrypt` installed, it failed there.
  
  To fix it: run `apt-get install php5-mcrypt && sudo php5enmod mcrypt`.
  
  
  ---
  
  