diff --git a/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx b/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx index b10387af84780..990ae4421be49 100644 --- a/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx +++ b/projects/packages/my-jetpack/_inc/components/welcome-flow/ConnectionStep.tsx @@ -35,10 +35,10 @@ const ConnectionStep = ( { const { recordEvent } = useAnalytics(); const { setNotice, resetNotice } = useContext( NoticeContext ); - const { purchaseToken, siteUrl, adminUrl } = getMyJetpackWindowInitialState(); + const { siteUrl, adminUrl } = getMyJetpackWindowInitialState(); const redirectUri = `?redirect_uri=${ encodeURIComponent( window.location.href ) }`; const connectAfterCheckoutUrl = `&connect_after_checkout=true&from_site_slug=${ siteUrl }&admin_url=${ adminUrl }`; - const query = `${ redirectUri }${ purchaseToken }${ connectAfterCheckoutUrl }`; + const query = `${ redirectUri }${ connectAfterCheckoutUrl }`; const jetpackPlansPath = getRedirectUrl( 'jetpack-nav-plans-no-site', { query } ); const activationButtonLabel = __( 'Activate Jetpack in one click', 'jetpack-my-jetpack' ); diff --git a/projects/packages/my-jetpack/src/class-initializer.php b/projects/packages/my-jetpack/src/class-initializer.php index adac96c4aa236..49c481e250905 100644 --- a/projects/packages/my-jetpack/src/class-initializer.php +++ b/projects/packages/my-jetpack/src/class-initializer.php @@ -202,27 +202,6 @@ public static function can_use_analytics() { return $tracking->should_enable_tracking( new Terms_Of_Service(), $status ); } - /** - * Gets a purchase token that is used for Jetpack logged out visitor checkout. - * The purchase token should be appended to all CTA url's that lead to checkout. - * - * @return string|boolean - */ - protected static function get_purchase_token() { - if ( ! self::current_user_can_purchase() ) { - return false; - } - - $purchase_token = \Jetpack_Options::get_option( 'purchase_token', false ); - - if ( $purchase_token ) { - return $purchase_token; - } - // If the purchase token is not saved in the options table yet, then add it. - \Jetpack_Options::update_option( 'purchase_token', self::generate_purchase_token(), true ); - return \Jetpack_Options::get_option( 'purchase_token', false ); - } - /** * Enqueue admin page assets. * @@ -287,7 +266,6 @@ public static function enqueue_scripts() { 'loadAddLicenseScreen' => self::is_licensing_ui_enabled(), 'adminUrl' => esc_url( admin_url() ), 'IDCContainerID' => static::get_idc_container_id(), - 'purchaseToken' => self::get_purchase_token(), 'userIsAdmin' => current_user_can( 'manage_options' ), 'userIsNewToJetpack' => self::is_jetpack_user_new(), 'lifecycleStats' => array( @@ -990,27 +968,4 @@ public static function alert_if_missing_connection( array $red_bubble_slugs ) { return $red_bubble_slugs; } - - /** - * Generates a purchase token that is used for Jetpack logged out visitor checkout. - * - * @return string - */ - protected static function generate_purchase_token() { - return wp_generate_password( 12, false ); - } - - /** - * Determine if the current user is allowed to make Jetpack purchases. - * - * @return boolean True if the user can make purchases, false if not - */ - public static function current_user_can_purchase() { - // Make sure only administrators can make purchases. - if ( ! current_user_can( 'manage_options' ) ) { - return false; - } - - return true; - } }