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

Handling PayPal Subscriptions - no Vaulting, no RT (2085) #2068

Open
AashikP opened this issue Mar 1, 2024 · 11 comments
Open

Handling PayPal Subscriptions - no Vaulting, no RT (2085) #2068

AashikP opened this issue Mar 1, 2024 · 11 comments
Labels
enhancement New feature or request

Comments

@AashikP
Copy link

AashikP commented Mar 1, 2024

Describe the Bug

It does not look like PayPal Payments is handling PayPal Subscriptions as per Recurring Payments Processed by the Gateway - Documentation.

To Reproduce

When the site isn't notified that the Subscription renewal is complete it keeps the Subscription active with the following error message:

image

In Subscription notes

image

Expected Behavior

This is how it should look like ideally if payment is overdue and handled by PayPal

image

Actual Behavior

This is what it looks like in WooCommerce → Subscriptions view:

46cAYc.png

Environment

  • WordPress Version: 6.4.3
  • WooCommerce Version: 8.6.1
  • Plugin Version: 2.5.4
  • Browser [e.g. Chrome, Safari] and Version: N/A
  • Any other plugins installed: N/A

Additional Details

Customer report: 7805872-zd-a8c

Internal Slack discussion: p1709115884793669-slack-C7U3Y3VMY

@SydeKrystian
Copy link
Collaborator

Hello @AashikP

This might be related to a bug in the previous version that your subscriptions mode is set to Vaulting, instead of PayPal Subscriptions, but GitHub is predominantly used for our development activities. For a prompt and detailed response, we kindly ask that you reach out directly to our support team.

When you contact our support team, please include a copy of your WooComnmerce system report. This will help us get to the bottom of your issue more quickly. Additionally, it would be beneficial if you could provide a more detailed description of the problem, as the information shared here is a bit ambiguous.

We'll be closing this GitHub issue for now. However, once you reach out to our support team, rest assured they'll be ready to assist you with your concerns. Thank you for your understanding!

Kind regards,
Krystian

@SydeKrystian SydeKrystian added the support Support case label Mar 1, 2024
@AashikP
Copy link
Author

AashikP commented Mar 1, 2024

Hello @InpsydeKrystian

The merchant in question does not have Valuting enabled, so that option isn't available for them. They had PayPal Subscriptions set for the Subscription mode.

I'm happy to forward that ticket over, but I just have one other question since I could not find where PayPal Payments implements gateway_scheduled_payments which is required as per Recurring Payments Processed by the Gateway - Documentation.

Any thoughts on that?

@SydeKrystian
Copy link
Collaborator

Hello @AashikP

The issue you're encountering with subscriptions being processed as if through Vaulting, despite correct settings in the Standard Payments tab, shouldn't occur in the latest version of the plugin. Without a system report, it's difficult to pinpoint the exact problem.

Regarding PayPal subscriptions, they are scheduled in a fixed manner and cannot be managed directly through WooCommerce. For more details on the limitations of PayPal subscriptions within WooCommerce, you can refer to the documentation available here: https://woo.com/document/woocommerce-paypal-payments/#limitations-with-paypal-subscriptions

Kind regards,
Krystian

@AashikP
Copy link
Author

AashikP commented Mar 1, 2024

Thank you for the context. I will be forwarding the ticket to your queue for further assistance.

Regarding PayPal subscriptions, they are scheduled in a fixed manner and cannot be managed directly through WooCommerce.

Right, and Subscription extension recommends gateway_scheduled_payments flag for PayPal Subscriptions. We could not find that within PayPal Payments extension. Are you saying that it is expected?

@SydeKrystian
Copy link
Collaborator

Hello @AashikP

Right, and Subscription extension recommends gateway_scheduled_payments flag for PayPal Subscriptions. We could not find that within PayPal Payments extension. Are you saying that it is expected?

The documentation is accurate, but it specifically applies to Vaulting. The term "PayPal Subscriptions" refers to a separate mode with its own set of limitations that differ from those of PayPal Vaulting, and this documentation does not cover those.

Kind regards,
Krystian

@AashikP
Copy link
Author

AashikP commented Mar 1, 2024

Thank you for explaining 👍

@james-allan
Copy link
Contributor

@InpsydeKrystian I'm not super familiar with all the PayPal terminology but when customers sign up to subscriptions using the PayPal Subscriptions feature, PayPal controls the scheduled of the subscription right?

So when the subscription renews on PayPal's end, I'm assuming there's a webhook or something similar sent to and processed by the site to record that a subscription payment was taken.

If so, how does the PayPal Payments plugin ensure that the normal Woo Subscription renewal processes don't run for those subscriptions? As @AashikP mentioned, we (Woo Subscriptions) expect that the gateway would declare that subscriptions which have a billing cycle maintained by the gateway itself as gateway_scheduled_payments.

By declaring the subscription as supporting gateway_scheduled_payments allows the Woo Subscriptions plugin to add additional features around these type of subscriptions but also to prevent attempting to raise renewal orders ourself. By not declaring these subscriptions as gateway_scheduled_payments is leading to issues like @AashikP mentioned.


When we use to have something similar where some PayPal subscriptions used billing agreements (similar or the same thing as "vaulting") and others were PayPal Standard subscriptions (similar to PayPal Subscriptions), we use to have a function hooked onto the woocommerce_subscription_payment_gateway_supports filter, check if the feature flag being checked is gateway_scheduled_payments and then pull the relevant meta off the subscription to determine if the specific subscription was a PayPal powered subscription or a vaulted, tokenised subscription. Does PayPal Payments do something similar to that? I couldn't find any mention of that supports flag or the hook.

@InpsydeNiklas InpsydeNiklas changed the title Handling PayPal Subscriptions - no Vaulting, no RT Handling PayPal Subscriptions - no Vaulting, no RT (2085) Mar 1, 2024
@InpsydeNiklas
Copy link
Member

@james-allan Thank you for the information, the team will look into improving the behavior here.

@Dinamiko
Copy link
Contributor

Dinamiko commented Mar 12, 2024

Hi @james-allan,

Thanks for the info, we're going to add support for gateway_scheduled_payments when subscription renewals are handled on PayPal side.

I'm assuming there's a webhook or something similar sent to and processed by the site to record that a subscription payment was taken.

Exactly, we are listening for PAYMENT.SALE.COMPLETED event and then create the renewal order from there:
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php#L102

How does the PayPal Payments plugin ensure that the normal Woo Subscription renewal processes don't run for those subscriptions?

We are currently using action_scheduler_before_execute action to unschedule the renewal action here:
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php#L638

To determine if a subscription is connected to a PayPal subscription we check if ppcp_subscription meta exist.

Other than that we are also adding other small adjustment like removing the manual renewal option from order actions selector:
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php#L206

cc @AashikP

@james-allan
Copy link
Contributor

Thanks for the info, we're going to add support for gateway_scheduled_payments when subscription renewals are handled on PayPal side.

Good to hear. Thanks for getting back to us. :)

We are currently using action_scheduler_before_execute action to unschedule the renewal action here:
https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php#L638

To determine if a subscription is connected to a PayPal subscription we check if ppcp_subscription meta exist.

Thanks for clarifying @Dinamiko. I guess that would work to prevent those subscriptions from renewing via the schedule. There are other instances where we trigger that hook manually just using a do_action() and using the gateway_scheduled_payments support flag should ensure this is handled automatically and the other features subscriptions includes for gateway_scheduled_payments.

@salmanbukhari1
Copy link

salmanbukhari1 commented Aug 26, 2024

Hi @james-allan,

Thanks for the info, we're going to add support for gateway_scheduled_payments when subscription renewals are handled on PayPal side.

I'm assuming there's a webhook or something similar sent to and processed by the site to record that a subscription payment was taken.

Exactly, we are listening for PAYMENT.SALE.COMPLETED event and then create the renewal order from there: https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-webhooks/src/Handler/PaymentSaleCompleted.php#L102

How does the PayPal Payments plugin ensure that the normal Woo Subscription renewal processes don't run for those subscriptions?

We are currently using action_scheduler_before_execute action to unschedule the renewal action here: https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php#L638

To determine if a subscription is connected to a PayPal subscription we check if ppcp_subscription meta exist.

Other than that we are also adding other small adjustment like removing the manual renewal option from order actions selector: https://github.com/woocommerce/woocommerce-paypal-payments/blob/trunk/modules/ppcp-paypal-subscriptions/src/PayPalSubscriptionsModule.php#L206

cc @AashikP

hey @Dinamiko Dinamiko Has the support for gateway_scheduled_payments when subscription renewals are handled on PayPal side been now added to the plugin?

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

No branches or pull requests

6 participants