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

[public-api] Add a placeholder Stripe webhook #11806

Merged
merged 4 commits into from
Aug 2, 2022

Conversation

andrew-farries
Copy link
Contributor

@andrew-farries andrew-farries commented Aug 2, 2022

Description

Add a placeholder Stripe webhook to the public-api component.

In later PRs, the webhook will:

  • receive invoice.finalized events from Stripe.
  • invoke RPCs on the usage component to update usage records to show that they have been included in a particular invoice.

This PR is a re-do of #11776, which added the webhook to the usage component directly.

After some discussion on that PR and internally, it was decided to move it to the public API and have the pubilc API invoke RPCs on usage instead.

Related Issue(s)

Part of #9036 and #10937

How to test

  • Install the stripe CLI into the workspace and run stripe login.
  • Port forward to the database in the preview environment:
kubectl port-forward svc/mysql 3306:3306
  • Run the public-api-server component locally:
cd components/public-api-server
go run . run  
  • Forward stripe events to the local webhook endpoint:
stripe listen --skip-verify --forward-to localhost:9002/webhook
  • Trigger a series of Stripe events:
stripe trigger invoice.finalized

This should start a series of Stripe events (setting up a customer and payment methods), each of which should be handled with a 200 OK by the webhook:

image

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview

@andrew-farries andrew-farries requested a review from a team August 2, 2022 12:21
@github-actions github-actions bot added the team: webapp Issue belongs to the WebApp team label Aug 2, 2022
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-af-stripe-webhook-on-public-api.2 because the annotations in the pull request description changed
(with .werft/ from main)

@@ -4,6 +4,9 @@
"services": {
"grpc": {
"address": ":9001"
},
"http": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love how easy this now is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/M team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants