You are here

function uc_stripe_uc_checkout_complete in Ubercart Stripe 8.2

Same name and namespace in other branches
  1. 8.3 uc_stripe.module \uc_stripe_uc_checkout_complete()
  2. 6.2 uc_stripe.module \uc_stripe_uc_checkout_complete()
  3. 7.3 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 70
A stripe.js PCI-compliant payment gateway

Code

function uc_stripe_uc_checkout_complete($order, $account) {
  if ($order->payment_method == "credit") {

    // Pull the stripe customer ID from the temp storage.
    // It got there in uc_stripe_checkout_form_customsubmit()
    // This is only really necessary for uc_recurring
    $stripe_customer_id = \Drupal::service('user.private_tempstore')
      ->get('uc_stripe')
      ->get('uc_stripe_customer_id');
    \Drupal::getContainer('user.data')
      ->set('uc_stripe', $account
      ->id(), 'uc_stripe_customer_id', $stripe_customer_id);
  }
}