strangerstudios / paid-memberships-pro

WordPress membership plugin to restrict access to content and charge recurring subscriptions using Stripe, PayPal, and more. Fully open source. 100% GPL.
https://www.paidmembershipspro.com
Other
464 stars 358 forks source link

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

Open kadinzimmerman opened 2 months ago

kadinzimmerman commented 2 months ago

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 commented 2 weeks ago

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 commented 2 weeks ago

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 commented 1 week ago

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 commented 1 week ago

@kimcoleman any insight / prioritization here? Thanks!