<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>

CC BY-SA 3.0
2016-06-21T01:07:04.593Z
Yeah I was confused by the 3-letter country code refernce in the docs, assumed it was 'aus', not a currency code :-)
Jarryd
CC BY-SA 3.0
2016-06-20T10:39:47.487Z
2016-06-20T19:49:33.100Z
2016-06-20T19:49:33.100Z
Joel Bradbury
<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>

<plugin-charge>
Unable to set planAmount for Charge 2 - Stripe
# 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:


    
    {% set options = {
        'planAmount': 79,
        'planInterval': 'year',
        'planIntervalCount': 1,
        'planCurrency': 'aus',
        'actions': {
            'onSuccess': {
                'subscription': 'gold-membership'
            }
        }
    } %}
    {{ craft.charge.setPaymentOptions(options) }}

    

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

    
        Card Number
        
    

    
        
            Expiration (MM/YY)
            
        
         / 
        
    

    
        Card CVC
        
    

    Upgrade


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 :-)  

---

