I'm currently trying to use the excellent "Charge" plugin to set up a simple Stripe checkout form for charity donations. The basic example provided in the docs works nicely.
<form method="post">
<input type="hidden" name="action" value="charge/charge"/>
{% set options = {
planAmount : 99.99,
description : 'This is an extra description',
checkout : {
name: 'Acme Corp',
}} %}
{{ craft.charge.setCheckoutOptions(options) }}
</form>
However I'm trying to update the 99.99 to use an amount that can be chosen by the client. My attempt at doing this involved having a separate form with a select box which when updated needs to update the planAmount.
I tried to do this using craft.request.getPost('name')
tying up to a jQuery post submit but I'm not sure if I'm even going about this the right way?
Is there any other way to update a variable in Craft/Twig through JS (or other user interaction)?