You are here

function uc_stripe_checkout_form_customsubmit in Ubercart Stripe 7.2

Same name and namespace in other branches
  1. 6.2 uc_stripe.module \uc_stripe_checkout_form_customsubmit()
  2. 7.3 uc_stripe.module \uc_stripe_checkout_form_customsubmit()

Custom submit function to store the stripe token

Since we don't have a user account at this step, we're going to store the token in the session. We'll grab the token in the charge callback and use it to charge

_state

Parameters

$form:

1 string reference to 'uc_stripe_checkout_form_customsubmit'
uc_stripe_form_uc_cart_checkout_form_alter in ./uc_stripe.module
Implements hook_form_FORMID_alter() to change the checkout form All work as a result is done in JS, the ordinary post does not happen.

File

./uc_stripe.module, line 397
A stripe.js PCI-compliant payment gateway Forked from Bitcookie's work (thanks!) which was posted at http://bitcookie.com/blog/pci-compliant-ubercart-and-stripe-js from discussion in the uc_stripe issue queue, https://www.drupal.org/node/1467886

Code

function uc_stripe_checkout_form_customsubmit($form, &$form_state) {

  // This submit may be entered on another payment type, so don't set session in that case.
  if (!empty($form_state['values']['panes']['payment']['details']['stripe_token'])) {
    $_SESSION['stripe']['token'] = $form_state['values']['panes']['payment']['details']['stripe_token'];
  }
}