-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[stripe] Use AttributionID metadata when querying for customers #12921
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
Conversation
27adefa
to
00ad1c5
Compare
started the job as gitpod-build-mp-server-stripe-attribution-id.1 because the annotations in the pull request description changed |
/werft run with-preview with-billing 👍 started the job as gitpod-build-mp-server-stripe-attribution-id.2 |
/werft run with-preview with-payment 👍 started the job as gitpod-build-mp-server-stripe-attribution-id.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up! Would be great to also generalize the methods in StripeService.
I.e. have findByAttributionID
and createCustomerForAttributionID
.
@@ -34,11 +36,15 @@ export class StripeService { | |||
} | |||
|
|||
async findCustomerByUserId(userId: string): Promise<Stripe.Customer | undefined> { | |||
return this.findCustomerByQuery(`metadata['userId']:'${userId}'`); | |||
return this.findCustomerByQuery( | |||
`metadata['${ATTRIBUTION_ID_METADATA_KEY}']:'${AttributionId.render({ kind: "user", userId })}'`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you plan to manually update existing customers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They've already been updated. The previous PR changed the subscription queries to set the attribution ID alongside the previous team/user id, this now removes old I'd usage
Description
Use
attributionId
when querying for customers, instead team/user IdRelated Issue(s)
Fixes #
How to test
attributionId:...
setRelease Notes
Documentation
Werft options: