Answers.Body: <p>Developer of <a href="http://squarebit.co.uk/software/craft/charge" rel="nofollow">Charge</a> here.</p>
  
  <p>This error is because you're passing an <strong>invalid currency code</strong>. </p>
  
  <p>You're passing <code>aus</code> as the planCurrency, but need to be passing <code>aud</code> for Australian Dollars. </p>
  
  <p>Under the hood, Charge is seeing that currency code as invalid, and unsetting the amount from the request, which is why that error is showing up on the planAmount. </p>
  
  <p><em>(Charge unsets the amount as a safety mechanism to prevent the request falling back and processing in the default currency)</em></p>
  
  <p>I'll update the language of the error to make it clearer the currency code is the invalid value in an upcoming release. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-21T01:07:04.593Z
Answers.Text: Yeah I was confused by the 3-letter country code refernce in the docs, assumed it was 'aus', not a currency code :-)
Answers.UserDisplayName: Jarryd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-20T10:39:47.487Z
Answers.LastActivityDate: 2016-06-20T19:49:33.100Z
Answers.LastEditDate: 2016-06-20T19:49:33.100Z
Answers.UserDisplayName: Joel Bradbury
Body: <p>I keep getting an error response for my test field for Charge. I've pretty closely followed the example just for testing and can't seem to get a successful charge.</p>
  
  <p>I've tried setting a hidden field for amount and planAmount to no success.</p>
  
  <p>Error:
  </p>
  
  <pre><code>array(1) {
    ["errors"]=&gt;
    array(2) {
      [0]=&gt;
      string(37) "planAmount : Amount must be a number."
      [1]=&gt;
      string(74) "There was a problem with your details, please check the form and try again"
    }
  }
  </code></pre>
  
  <p>Form:
  </p>
  
  <pre><code>&lt;form method="post" id="charge-form" class="charge-form"&gt;
      &lt;input type="hidden" name="action" value="charge/charge"&gt;
      {% set options = {
          'planAmount': 79,
          'planInterval': 'year',
          'planIntervalCount': 1,
          'planCurrency': 'aus',
          'actions': {
              'onSuccess': {
                  'subscription': 'gold-membership'
              }
          }
      } %}
      {{ craft.charge.setPaymentOptions(options) }}
  
      &lt;div id="payment-errors"&gt;&lt;/div&gt;
  
      &lt;div&gt;
          &lt;label for="customerEmail"&gt;Receipt Email&lt;/label&gt;
          &lt;input type="text" name="customerEmail" value="{{ charge is defined ? charge.customerEmail : currentUser ? currentUser.email }}" id="customerEmail"&gt;
          {% if charge is defined %}{% for error in charge.getErrors('customerEmail') %}{{ error }}{% endfor %}{% endif %}
      &lt;/div&gt;
  
      &lt;div&gt;
          &lt;label for="cardNumber"&gt;Card Number&lt;/label&gt;
          &lt;input type="text" data-stripe="number" placeholder="•••• •••• •••• ••••" id="cardNumber"&gt;
      &lt;/div&gt;
  
      &lt;div&gt;
          &lt;label&gt;
              &lt;span&gt;Expiration (MM/YY)&lt;/span&gt;
              &lt;input type="text" size="2" data-stripe="exp_month"&gt;
          &lt;/label&gt;
          &lt;span&gt; / &lt;/span&gt;
          &lt;input type="text" size="2" data-stripe="exp_year"&gt;
      &lt;/div&gt;
  
      &lt;div&gt;
          &lt;label for="cardCvc"&gt;Card CVC&lt;/label&gt;
          &lt;input type="text" data-stripe="cvc" placeholder="123" id="cardCvc"&gt;
      &lt;/div&gt;
  
      &lt;button type="submit"&gt;Upgrade&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>JS:
  </p>
  
  <pre><code>Stripe.setPublishableKey(this.s.publicKey.test);
  $(window).charge(this.s.form);
  </code></pre>
  
Tags: <plugin-charge>
Title: Unable to set planAmount for Charge 2 - Stripe
ThreadText: # Unable to set planAmount for Charge 2 - Stripe
  
  (Asked by: username_0 on 2016-06-20)
  
  I keep getting an error response for my test field for Charge. I've pretty closely followed the example just for testing and can't seem to get a successful charge.
  
  I've tried setting a hidden field for amount and planAmount to no success.
  
  Error:
  
  ```
  array(1) {
    ["errors"]=>
    array(2) {
      [0]=>
      string(37) "planAmount : Amount must be a number."
      [1]=>
      string(74) "There was a problem with your details, please check the form and try again"
    }
  }
  
  ```
  
  Form:
  
  ```
  <form method="post" id="charge-form" class="charge-form">
      <input type="hidden" name="action" value="charge/charge">
      {% set options = {
          'planAmount': 79,
          'planInterval': 'year',
          'planIntervalCount': 1,
          'planCurrency': 'aus',
          'actions': {
              'onSuccess': {
                  'subscription': 'gold-membership'
              }
          }
      } %}
      {{ craft.charge.setPaymentOptions(options) }}
  
      <div id="payment-errors"></div>
  
      <div>
          <label for="customerEmail">Receipt Email</label>
          <input type="text" name="customerEmail" value="{{ charge is defined ? charge.customerEmail : currentUser ? currentUser.email }}" id="customerEmail">
          {% if charge is defined %}{% for error in charge.getErrors('customerEmail') %}{{ error }}{% endfor %}{% endif %}
      </div>
  
      <div>
          <label for="cardNumber">Card Number</label>
          <input type="text" data-stripe="number" placeholder="•••• •••• •••• ••••" id="cardNumber">
      </div>
  
      <div>
          <label>
              <span>Expiration (MM/YY)</span>
              <input type="text" size="2" data-stripe="exp_month">
          </label>
          <span> / </span>
          <input type="text" size="2" data-stripe="exp_year">
      </div>
  
      <div>
          <label for="cardCvc">Card CVC</label>
          <input type="text" data-stripe="cvc" placeholder="123" id="cardCvc">
      </div>
  
      <button type="submit">Upgrade</button>
  </form>
  
  ```
  
  JS:
  
  ```
  Stripe.setPublishableKey(this.s.publicKey.test);
  $(window).charge(this.s.form);
  
  ```
  
  **Tags:** plugin-charge
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-20. Score: 4 | Accepted answer
  
  Developer of [Charge](http://squarebit.co.uk/software/craft/charge) here.
  
  This error is because you're passing an **invalid currency code**.
  
  You're passing `aus` as the planCurrency, but need to be passing `aud` for Australian Dollars.
  
  Under the hood, Charge is seeing that currency code as invalid, and unsetting the amount from the request, which is why that error is showing up on the planAmount.
  
  *(Charge unsets the amount as a safety mechanism to prevent the request falling back and processing in the default currency)*
  
  I'll update the language of the error to make it clearer the currency code is the invalid value in an upcoming release.
  
  > **Comments:**
  > **username_0**: Yeah I was confused by the 3-letter country code refernce in the docs, assumed it was 'aus', not a currency code :-)  
  
  ---
  
  