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

payment_methods endpoint returns hasSubscription true for canceled subscriptions #571

Open
charidimostzed opened this issue May 31, 2021 · 7 comments

Comments

@charidimostzed
Copy link

charidimostzed commented May 31, 2021

General information

  • SDK version: 3.73.1
  • Environment: Sandbox
  • Browser and OS: Chrome 90.0.4430.212 (64-bit) on MacOS 10.15.7

Issue description

Hello there,

Regarding the /payment_methods endpoint, we noticed that hasSubscription:true is returned for cards that their subscriptions have been canceled. Are there any recent changes to the endpoint?

Is this maybe connected to #566?

Thank you in advance

@crookedneighbor
Copy link
Contributor

I don't think it's related to #566

I think the logic we are using to populate the value just checks if there is a subscription object attached to the payment method at all, regardless of the status of the subscription.

We'll have to think about the best way to handle this situation. It's pretty clear cut that the subscription is tied to the payment method when the status is active and no longer tied to the payment method when canceled, but I'm not 100% sure on the situations for the other statuses.

My assumption here is that expired and past due subscription would also have hasSubscription: false while pending would have hasSubscription: true, but I want to check in with my team and the owners of the API before making those changes. Basically, we can only due that if canceled, expired, and past due are terminal states, indicating that there's no way for the subscription to be re-activated. Otherwise, we risk creating a breaking change.

@charidimostzed
Copy link
Author

What we observed is that on some cases hasSubscription:true is returned even if the state of the subscription is canceled.

Thanks a lot for the reply, looking forward for the solution that will be covering all the terminal states.

@crookedneighbor
Copy link
Contributor

OK, I've done a little research on this.

I think I'm correct that if a payment method has an associated subscription in a pending or active state, it should have hasSubscription: true.

canceled and expired subscriptions are indeed terminal states, so I think it's safe to update the logic to hasSubscription: false for those states.

past due however, is not a terminal state. Parts of the subscription can be updated: https://developer.paypal.com/braintree/docs/guides/recurring-billing/manage#updating-past-due-subscriptions

So I think it's a little up to interpretation here whether or not a past due state should indicate it has a subscription or not. Because deleting a payment methods with a past due subscription will result in the subscription being put into a canceled state, which is terminal, I think it's probably safest to indicate that payment methods with subscriptions that are past due should report hasSubscription: true. That way, if the logic about whether to allow deleting a payment method on the client is using hasSubscription as the determiner, past due subscriptions won't be accidentally cancelled by deleting a payment method.

Does that track with your use case @charidimostzed ? Or do you have a different perspective?

@charidimostzed
Copy link
Author

Hello @crookedneighbor, yes this is covers up our needs fully. Thank you very much!

@charidimostzed
Copy link
Author

Hello @crookedneighbor! Do we have any updates on this one? thank you very much

@crookedneighbor
Copy link
Contributor

No update yet, we have a lot of things on our plate and this has not yet been prioritized. I would encourage you to reach out to our support team or your account manager to get more visibility on this improvement.

@charidimostzed
Copy link
Author

@crookedneighbor thanks a lot for the reply!

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

2 participants