diff --git a/functions.php b/functions.php index 8d4e93b..b501529 100644 --- a/functions.php +++ b/functions.php @@ -304,8 +304,10 @@ function quiztech_handle_credit_purchase_submission() { // Check if the plugin function exists and call it // Note: The plugin function expects (user_id, item_id, quantity) if ( function_exists( '\Quiztech\AssessmentPlatform\Includes\quiztech_initiate_credit_purchase' ) ) { + log_to_file("Stripe - Function exists"); // Pass package_id as item_id, quantity is 1 for these packages $result = \Quiztech\AssessmentPlatform\Includes\quiztech_initiate_credit_purchase( $user_id, $package_id, 1 ); + log_to_file("Stripe - Result: ", $result); // If the function returns an error, redirect back with the message if ( is_wp_error( $result ) ) { @@ -321,7 +323,7 @@ function quiztech_handle_credit_purchase_submission() { // If it somehow didn't redirect AND didn't return an error, we might end up here. // We could add a fallback redirect with 'initiated' status, but ideally the plugin handles it. // For now, assume the plugin handles the success redirect or returns WP_Error. - + log_to_file("Stripe - We shouldn't be here"); } else { // Function doesn't exist - plugin likely inactive or issue $redirect_url = add_query_arg( array(