PluginProbe
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions / 261001
s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions v261001
261001 260927 260917 260913 260909 260829 260814 260805 110710 110731 110812 110815 110912 110913 110915 110926 110927 111002 111003 111011 111017 111029 111105 111206 111216 All 191 releases
← All changes | src/includes/classes/paypal-webhook-in.inc.php +23 -0 260909 → 261001 View file →
@@ -388,8 +388,31 @@
388 388 status_header(500);
389 389 exit();
390 390 }
391 391
392 +
393 + //260928.1538 Standalone Framework buttons are coordinator-backed; a verified activation now recovers all original purchase terms and completes membership even if the browser never calls confirm_subscription.
394 + if(strpos((string)$paypal['invoice'], 's2mb-') === 0)
395 + {
396 + $button_checkout_id = c_ws_plugin__s2member_paypal_utilities::paypal_checkout_gateway_checkout_id_from_invoice((string)$paypal['invoice']);
397 + $button_private = $button_checkout_id ? c_ws_plugin__s2member_gateway_checkouts::private_context_get($button_checkout_id) : FALSE;
398 + $button_token = is_array($button_private) && !empty($button_private['paypal_checkout']['token']) && is_array($button_private['paypal_checkout']['token']) ? $button_private['paypal_checkout']['token'] : array();
399 + $subscription_details = $subscr_id ? c_ws_plugin__s2member_paypal_utilities::paypal_checkout_subscription_details($subscr_id) : array();
400 + $button_fulfillment = (!$button_token || !empty($subscription_details['__error']))
401 + ? array('ok' => FALSE, 'error' => 'gateway_checkout_purchase_context_or_provider_missing')
402 + : c_ws_plugin__s2member_paypal_utilities::paypal_checkout_button_subscription_fulfill($subscription_details, $button_token, 'webhook');
403 + if(empty($button_fulfillment['ok']))
404 + {
405 + c_ws_plugin__s2member_utils_logs::log_entry('paypal-checkout', array('ppco' => 'webhook', 'event' => 'button_subscription_fulfillment_retry', 'subscription_id' => $subscr_id, 'invoice' => (string)$paypal['invoice'], 'error' => !empty($button_fulfillment['error']) ? (string)$button_fulfillment['error'] : 'unknown'));
406 + c_ws_plugin__s2member_paypal_utilities::dedupe_lock_release($event_lock_option);
407 + status_header(500); //260928.1538 Leave the activation event unconsumed so PayPal retries on temporary recovery/Notify failure.
408 + exit();
409 + }
410 + c_ws_plugin__s2member_paypal_utilities::dedupe_done_mark($event_done_option);
411 + c_ws_plugin__s2member_paypal_utilities::dedupe_lock_release($event_lock_option);
412 + status_header(200);
413 + exit();
414 + }
392 415 $paypal['txn_type'] = 'subscr_signup'; //260401 Keep webhook activation as a fallback to the legacy signup handler only when checkout did not already handle this Subscription.
393 416 $paypal['payment_status'] = 'Completed';
394 417
395 418 $subscr_handled_by_webhook = true;