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.


array(1) {
  array(2) {
    string(37) "planAmount : Amount must be a number."
    string(74) "There was a problem with your details, please check the form and try again"


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

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

        <label for="cardNumber">Card Number</label>
        <input type="text" data-stripe="number" placeholder="•••• •••• •••• ••••" id="cardNumber">

            <span>Expiration (MM/YY)</span>
            <input type="text" size="2" data-stripe="exp_month">
        <span> / </span>
        <input type="text" size="2" data-stripe="exp_year">

        <label for="cardCvc">Card CVC</label>
        <input type="text" data-stripe="cvc" placeholder="123" id="cardCvc">

    <button type="submit">Upgrade</button>



Developer of 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.

  • Yeah I was confused by the 3-letter country code refernce in the docs, assumed it was 'aus', not a currency code :-)
    – Jarryd
    Jun 21 '16 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.