Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Membership not created, order status "Token" when stripe Link checkout used #3086

Open
kadinzimmerman opened this issue Jul 25, 2024 · 6 comments

Comments

@kadinzimmerman
Copy link

I can't exactly pinpoint if this is what is causing it but I believe it is. When a member checks out, we noticed some memberships not getting created (the user is getting created but no membership attached), the payment through stripe is successfully happening but membership not attaching. The order status in PMPRO is "Token". From what I can find as the common factor, is that the payment was done using stripe Link.

Link autofills your customer's payment details for faster checkout.

Can you check into this to see if it's a bug with Link payments vs non-link and the status being stuck as "Token" and the membership not fully finalized? Again the user is created and the payment is successfully captured. No issues with the payment side of things.

@Creatium
Copy link

Creatium commented Sep 26, 2024

I can add that we have noticed same issue. Though our debug logs also show Fatal errors happening during that time, so there is something not ok.

[16-Sep-2024 13:03:18 UTC] PHP Fatal error:  Uncaught TypeError: array_merge(): Argument #2 must be of type array, bool given in /home/user/domains/domain.com/public_html/wp-content/plugins/paid-memberships-pro/includes/checkout.php:156
Stack trace:
#0 /home/user/domains/domain.com/public_html/wp-content/plugins/paid-memberships-pro/includes/checkout.php(156): array_merge()
#1 /home/user/domains/domain.com/public_html/wp-content/plugins/paid-memberships-pro/services/stripe-webhook.php(677): pmpro_pull_checkout_data_from_order()
#2 /home/user/domains/domain.com/public_html/wp-content/plugins/paid-memberships-pro/services/stripe-webhook.php(518): pmpro_stripe_webhook_change_membership_level()
#3 /home/user/domains/domain.com/public_html/wp-content/plugins/paid-memberships-pro/includes/services.php(40): require_once('...')
#4 /home/user/domains/domain.com/public_html/wp-includes/class-wp-hook.php(324): pmpro_wp_ajax_stripe_webhook()
#5 /home/user/domains/domain.com/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#6 /home/user/domains/domain.com/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#7 /home/user/domains/domain.com/public_html/wp-admin/admin-ajax.php(207): do_action()
#8 {main}
  thrown in /home/user/domains/domain.com/public_html/wp-content/plugins/paid-memberships-pro/includes/checkout.php on line 156

Plugin version 3.1.3, WP version 6.6.2, PHP 8.1

@Creatium
Copy link

I think this might have been an issue with Stripe webhooks not being updated correctly. Did the update procedure in Memberships -> Settings, will see if error disappears.

Events checkout.session.async_payment_succeeded and checkout.session.async_payment_failed were both status as N/A.

@Creatium
Copy link

Creatium commented Sep 30, 2024

No, the issue is not gone with the webhooks update.

Stripe shows that checkout.session.completed got the response of 500 Internal error from Wordpress. So this is related to the error message in WP debug logs.

Changing line 156 of file includes/checkout.php to this seems to fix the issue:
$_REQUEST = array_merge( $_REQUEST, $checkout_request_vars ?: array() );

@121940kz
Copy link

@kimcoleman any insight / prioritization here? Thanks!

@Creatium
Copy link

Any updates? Seems to me that changing 156 line to not throw error leads to users not being assigned custom fields.

@Creatium
Copy link

Ok. I think I managed to pinpoint the cause of the error to the database table pmpro_membership_ordermeta having bad collation set to latin1_swedish_ci which resulted in UTF-8 characters not saving properly, which lead to meta_value with meta_key = 'checkout_request_vars' serialized string having not correct string length for baddress parameter. In two cases I checked, I was unable to unserialize meta_value with PHP throwing errors when baddress was with '?' instead of 'ų' and resulting in -1 in real string length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants