More Stripe Troubleshooting

This commit is contained in:
Ruben Ramirez 2025-04-04 03:00:48 -05:00
parent 0c62dad786
commit 410b9c650e

View file

@ -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(