invertase / stripe-firebase-extensions

Repository of Firebase Extensions built by Stripe.
https://firebase.google.com/products/extensions
Apache License 2.0
436 stars 170 forks source link

Cleanup checkout_sessions #122

Open codercatdev opened 3 years ago

codercatdev commented 3 years ago

Feature request

firestore-stripe-subscriptions

Is your feature request related to a problem? Please describe.

This is not necessarily a problem, more of a refinement. If you have a user who keeps creating checkout_session docs it would be nice to either include a schedule cloud function to delete all out dated sessions, or on subscription completion remove all session. image

Describe the solution you'd like

I would think that after 24 hours (which is really long, maybe allow this to be customized). Create a scheduled cloud function that would look at checkout_sessions/{sessionId}/created and take the given set time and if these still exist delete them.

Describe alternatives you've considered

The alternative is either allow someone else to create this, or on subscription update, purge all checkout_sessions.

Additional context

I am happy to write it if you would like.

thorsten-stripe commented 3 years ago

These are meant as logs of your customer's checkout attempts. There shouldn't be too many. Can you elaborate what your concern is with keeping these in Firestore?

codercatdev commented 3 years ago

That is fair there won't be a lot but with a million customers if they subscribe and then unsubscribe even once a year that is a giant amount of data that is being added to your overall firestore db. It would be nice to keep these clean. IMO the subscription data is what you should care about and Stripe is handling all of this.

On Mon, Jan 11, 2021 at 2:32 AM Thor 雷神 notifications@github.com wrote:

These are meant as logs of your customer's checkout attempts. There shouldn't be too many. Can you elaborate what your concern is with keeping these in Firestore?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stripe/stripe-firebase-extensions/issues/122#issuecomment-757675547, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXVMKNCU55XVCUIGPSMJBDSZKSRLANCNFSM4V32CA3A .

-- Thank You, Alex Patterson Need to meet? Book a time: https://calendly.com/codingcatdev

🌎CodingCat.dev https://codingcat.dev || 🎥 YouTube https://link.ajonp.com/youtube || 🐦 Twitter https://twitter.com/CodingCatDev || 📷 Instagram https://www.instagram.com/codingcat.dev/

jsteele-stripe commented 2 years ago

We could make this configurable/opt-in and utilise the checkout.session.expired event to purge any expired Checkout Session documents in Firestore.

Hibrix-net commented 1 year ago

That is fair there won't be a lot but with a million customers if they subscribe and then unsubscribe even once a year that is a giant amount of data that is being added to your overall firestore db. It would be nice to keep these clean. IMO the subscription data is what you should care about and Stripe is handling all of this. On Mon, Jan 11, 2021 at 2:32 AM Thor 雷神 @.***> wrote: These are meant as logs of your customer's checkout attempts. There shouldn't be too many. Can you elaborate what your concern is with keeping these in Firestore? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#122 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXVMKNCU55XVCUIGPSMJBDSZKSRLANCNFSM4V32CA3A . -- Thank You, Alex Patterson Need to meet? Book a time: https://calendly.com/codingcatdev 🌎CodingCat.dev https://codingcat.dev || 🎥 YouTube https://link.ajonp.com/youtube || 🐦 Twitter https://twitter.com/CodingCatDev || 📷 Instagram https://www.instagram.com/codingcat.dev/

Hello,

I wholeheartedly concur with your perspective. The necessity to create and populate a collection with session objects is something I find perplexing. According to the Stripe documentation, there's no requirement for such additional steps. It's sufficient to generate the checkout session ID and then redirect the user to the Stripe checkout page. Stripe already handles the storage of all session logs.

In my opinion, the current approach seems to indicate a gap in logical architecture design. However, I'm open to the possibility that I might be missing some crucial information or context. Could you please shed some light on this?

Best regards,