You are here

function _commerce_stripe_form_configure_stripe_common in Commerce Stripe 7

Same name and namespace in other branches
  1. 7.3 commerce_stripe.module \_commerce_stripe_form_configure_stripe_common()

Parameters

$form:

$stripe_token:

$public_key:

$integration_type:

1 call to _commerce_stripe_form_configure_stripe_common()
commerce_stripe_cardonfile_create_form in ./commerce_stripe.module
Card on file callback: create form

File

./commerce_stripe.module, line 962
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_form_configure_stripe_common(&$form, $stripe_token, $public_key, $integration_type) {

  // Add stripe token field. This field is a container for token received from
  // Stripe API's response handler.
  $form['stripe_token'] = array(
    '#type' => 'hidden',
    '#attributes' => array(
      'id' => 'stripe_token',
    ),
    '#default_value' => !empty($stripe_token) ? $stripe_token : '',
  );

  // Set our key to settings array.
  drupal_add_js(array(
    'stripe' => array(
      'publicKey' => $public_key,
      'integration_type' => $integration_type,
    ),
  ), 'setting');

  // Load commerce_stripe.js.
  $form['#attached']['js'] = array(
    drupal_get_path('module', 'commerce_stripe') . '/commerce_stripe.js',
  );
}