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