You are here

function _commerce_stripe_elements_form in Commerce Stripe 7.3

Callback for the Stripe Elements form.

2 calls to _commerce_stripe_elements_form()
commerce_stripe_cardonfile_create_form in ./commerce_stripe.module
Card on file callback: create form
commerce_stripe_submit_form in ./commerce_stripe.module
Payment method callback: checkout and terminal form.

File

./commerce_stripe.module, line 1763
This module provides Stripe (http://stripe.com/) payment gateway integration to Commerce. Commerce Stripe offers a PCI-compliant way to process payments straight from you Commerce shop.

Code

function _commerce_stripe_elements_form() {
  $form = array();
  $form['credit_card'] = array(
    '#tree' => TRUE,
    '#attached' => array(
      'css' => array(
        drupal_get_path('module', 'commerce_payment') . '/theme/commerce_payment.theme.css',
      ),
    ),
  );

  // Add a field for the credit card owner if specified.
  if (isset($fields['owner'])) {
    $form['credit_card']['owner'] = array(
      '#type' => 'textfield',
      '#title' => t('Card owner'),
      '#attributes' => array(
        'autocomplete' => 'off',
        'placeholder' => variable_get('commerce_stripe_owner_placeholder', 'John Q. Smith'),
      ),
      '#required' => TRUE,
      '#maxlength' => 64,
      '#size' => 32,
    );
  }
  $form['credit_card']['number'] = array(
    '#type' => 'item',
    '#markup' => '<label for="card-element">Card number</label><div data-stripe="number" id="card-element"></div>',
  );
  $form['card_errors'] = array(
    '#type' => 'item',
    '#markup' => '<div data-stripe-errors="number" class="stripe-errors form-text" id="card-errors"></div>',
    '#weight' => 0,
  );
  return $form;
}