'Submit charge to stripe.
Called by GoldPayment form. This submits the charge to stripe, and gold
will be applied once we receive a webhook from stripe.'

@csrf_exempt
@validatedForm(token=nop('stripeToken'), passthrough=VPrintable('passthrough', max_length=50), pennies=VInt('pennies'), months=VInt('months'), period=VOneOf('period', ('monthly', 'yearly')))
def POST_goldcharge(self, form, jquery, token, passthrough, pennies, months, period):

    try:
        payment_blob = validate_blob(passthrough)
    except GoldException as e:
        form.set_text('.status', _('something    bad    happened,    try    again    later'))
        g.log.debug(('POST_goldcharge:    %s' % e.message))
        return
    if period:
        plan_id = (g.STRIPE_MONTHLY_GOLD_PLAN if (period == 'monthly') else g.STRIPE_YEARLY_GOLD_PLAN)
        if c.user.has_gold_subscription:
            form.set_text('.status', _('your    account    already    has    a    gold    subscription'))
            return
    else:
        plan_id = None
        (penny_months, days) = months_and_days_from_pennies(pennies)
        if ((not months) or (months != penny_months)):
            form.set_text('.status', _('stop    trying    to    trick    the    form'))
            return
    if c.user_is_loggedin:
        description = c.user.name
    else:
        description = payment_blob['email']
    customer = self.create_customer(form, token, description)
    if (not customer):
        return
    if period:
        subscription = self.set_subscription(form, customer, plan_id)
        if (not subscription):
            return
        c.user.gold_subscr_id = customer.id
        c.user._commit()
        status = _('subscription    created')
        subject = _('reddit    gold    subscription')
        body = _('Your    subscription    is    being    processed    and    reddit    gold    will    be    delivered    shortly.')
    else:
        charge = self.charge_customer(form, customer, pennies, passthrough, description)
        if (not charge):
            return
        status = _('payment    submitted')
        subject = _('reddit    gold    payment')
        body = _('Your    payment    is    being    processed    and    reddit    gold    will    be    delivered    shortly.')
    form.set_text('.status', status)
    if c.user_is_loggedin:
        body = append_random_bottlecap_phrase(body)
        send_system_message(c.user, subject, body, distinguished='gold-auto')
        form.redirect('/gold/thanks?v=stripe')
