You are here

function uc_stripe_uc_checkout_complete in Ubercart Stripe 7.3

Same name and namespace in other branches
  1. 8.3 uc_stripe.module \uc_stripe_uc_checkout_complete()
  2. 8.2 uc_stripe.module \uc_stripe_uc_checkout_complete()
  3. 6.2 uc_stripe.module \uc_stripe_uc_checkout_complete()
  4. 7.2 uc_stripe.module \uc_stripe_uc_checkout_complete()

Implements hook_uc_checkout_complete()

Saves stripe customer_id into the user->data object

Parameters

$order:

$account:

File

./uc_stripe.module, line 359
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_uc_checkout_complete($order, $account) {
  if ($order->payment_method == "credit" && uc_credit_default_gateway() == 'uc_stripe') {

    // Pull the stripe payment method ID from the session.
    // It got there in uc_stripe_checkout_form_customsubmit()
    $stripe_payment_id = $_SESSION['stripe']['payment_method'];
    $stripe_customer_id = $order->data['stripe_customer_id'];
    $loaded_user = user_load($account->uid);
    user_save($loaded_user, array(
      'data' => array(
        'uc_stripe_customer_id' => $stripe_customer_id,
      ),
    ));
    user_save($loaded_user, array(
      'data' => array(
        'uc_stripe_payment_id' => $stripe_payment_id,
      ),
    ));
  }
}