@@ 367-378 (lines=12) @@ | ||
364 | $maybe_saved_card = isset( $_POST['wc-stripe-new-payment-method'] ) && ! empty( $_POST['wc-stripe-new-payment-method'] ); |
|
365 | ||
366 | // This is true if the user wants to store the card to their account. |
|
367 | if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_customer ) { |
|
368 | $stripe_source = $stripe_customer->add_card( $stripe_token ); |
|
369 | ||
370 | if ( is_wp_error( $stripe_source ) ) { |
|
371 | throw new Exception( $stripe_source->get_error_message() ); |
|
372 | } |
|
373 | ||
374 | } else { |
|
375 | // Not saving token, so don't define customer either. |
|
376 | $stripe_source = $stripe_token; |
|
377 | $stripe_customer = false; |
|
378 | } |
|
379 | } |
|
380 | ||
381 | // Use an existing token, and then process the payment |
@@ 470-481 (lines=12) @@ | ||
467 | $maybe_saved_card = isset( $_POST['wc-stripe-new-payment-method'] ) && ! empty( $_POST['wc-stripe-new-payment-method'] ); |
|
468 | ||
469 | // This is true if the user wants to store the card to their account. |
|
470 | if ( ( $user_id && $this->saved_cards && $maybe_saved_card ) || $force_customer ) { |
|
471 | $stripe_source = $stripe_customer->add_card( $stripe_token ); |
|
472 | ||
473 | if ( is_wp_error( $stripe_source ) ) { |
|
474 | throw new Exception( $stripe_source->get_error_message() ); |
|
475 | } |
|
476 | ||
477 | } else { |
|
478 | // Not saving token, so don't define customer either. |
|
479 | $stripe_source = $stripe_token; |
|
480 | $stripe_customer = false; |
|
481 | } |
|
482 | } |
|
483 | ||
484 | // Use an existing token, and then process the payment |