Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's 3 main changes:
publishable_keytoStripeApiHowever, the main goal for opening the PR is merge 1, the publishable key, because it's used by the
solve-lpbilling code. Number 2 & 3 are nice-to-haves but could be merged later, they might change shape a bit.1.
publishable_keyWe added the
publishable_keyto theStripeApiclass. This public key is used by stripe.js so we can collect the CC cards of the users through the `setupIntent (docs here. This is used by the upcoming solve-lp PR to set up payment intents.2. Webhook handling
We added all the machinery necessary to process stripe webhooks. In order to make it nicer we created return classes for all the StripeApi objects using the component schemas from the OpenAPI. Those are the changes in
spec.pyand the newclass StripeObjandstripe_objincore.py.The reason to add our own signature verification and webhook parsing is to avoid having to import both
faststripefor API calls and then also thestripeofficial library for webhook handling (as it currently happens in plash & solve-lp). Having them in a single library will make it easier to test and make sure they remain in sync because we had an issue wherestripeversion was auto-updated and it broke our webhook handling.We also added a
service_nameto theStripeApi. Theservice_nameis an attempt to standardize how each app filters its own webhooks. Currently all apps receive all webhooks and handle them differently. Including metadata with the service name a then callingfilter_eventsshould make it easier.However, this is not yet used, and including metadata in all webhooks is tricky because each API call includes it differently. Products, subscriptions and charges all have the metadata in a different place. If we end up migrating plash into solveit, this will not be a concern anymore, so we might not use it. I suggest leaving it for now, we are currently working on a
how-toapp (not commited here) and we might include it.3 high-level methods
As agreed on discord all the high-level methods have been commented. They deal with creating Price, Products, Subscription, and one-time payments. None of those are required now that we'll use setupIntent + charges so it is likely we will get rid of them, or they might change shape.
Finally I added a
.env.examplebecause I feel it's very useful to quickly land and get a repo running.