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

Stripe::Source no longer supports .delete method #1062

Closed
kceb opened this issue May 24, 2022 · 2 comments
Closed

Stripe::Source no longer supports .delete method #1062

kceb opened this issue May 24, 2022 · 2 comments
Assignees
Labels

Comments

@kceb
Copy link

kceb commented May 24, 2022

Describe the bug

In the past, I recall being able to run .delete on an instance of Stripe::Source. Currently, when I try it, I get the following error message:

NoMethodError: undefined method `delete' for #<Stripe::Source:0x00007fc09c90f5d8>

Was this removed from the API at some point?

To Reproduce

  1. Fetch a Stripe::Source instance
  2. Run .delete on it

Expected behavior

We delete the source

Code snippets

No response

OS

macOS

Language version

Ruby 2.7.4p191

Library version

stripe (5.55.0)

API version

2020-03-02

Additional context

No response

@kceb kceb added the bug label May 24, 2022
@remi-stripe remi-stripe self-assigned this May 24, 2022
@remi-stripe
Copy link
Contributor

The delete method on Source was deprecated back in 2017 in our 3.5.0 version.
It was then removed entirely in our major version 5.0.0 released in August 2019. We covered all the breaking changes in this migration guide.

Instead you should use detach

@kceb
Copy link
Author

kceb commented May 25, 2022

Update to those that may face a similar issue --
it seems like calling Stripe::Customer#sources returns a collection that can contain multiple types (for example: it can contain a Stripe::Source or a Stripe::Card). When I posted this issue, I assumed it only returned a collection of source types.

Seems like I may have experienced it working before on v5 because in my prior use case, I was calling #delete on a Stripe::Card, which is still a supported method.

To be safe -- I'll just migrate over to the detach_source approach as that seems to work on both stripe cards and stripe sources.

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

No branches or pull requests

2 participants