Merge pull request #28388 from overleaf/ls-set-and-use-user-id-on-customer-object

Set and use userId on customer object

GitOrigin-RevId: 44749df8135154348fbf099db3c680d3d3212ff3
This commit is contained in:
Liangjun Song
2025-09-17 15:03:15 +08:00
committed by Copybot
parent 1fe750910e
commit aaeacb52b7
2 changed files with 27 additions and 0 deletions
@@ -650,11 +650,14 @@ class PaymentProviderAccount {
* @param {string} props.code
* @param {string} props.email
* @param {boolean} [props.hasPastDueInvoice]
* @param {object} [props.metadata]
* @param {string} [props.metadata.userId]
*/
constructor(props) {
this.code = props.code
this.email = props.email
this.hasPastDueInvoice = props.hasPastDueInvoice ?? false
this.metadata = props.metadata ?? {}
}
}
@@ -7,6 +7,7 @@ export type CustomerSubscriptionUpdatedWebhookEvent = {
metadata: {
adminUserId?: string
}
customer: string
}
// https://docs.stripe.com/api/events/object?api-version=2025-04-30.basil#event_object-data-previous_attributes
previous_attributes: {
@@ -35,6 +36,7 @@ export type CustomerSubscriptionCreatedWebhookEvent = {
metadata: {
adminUserId?: string
}
customer: string
}
}
}
@@ -46,6 +48,7 @@ export type CustomerSubscriptionsDeletedWebhookEvent = {
metadata: {
adminUserId?: string
}
customer: string
}
}
}
@@ -90,6 +93,25 @@ export type InvoiceOverdueWebhookEvent = {
request: Stripe.Event.Request
}
export type CheckoutSessionCompletedWebhookEvent = {
type: 'checkout.session.completed'
data: {
object: Stripe.Checkout.Session & {
metadata: {
userId?: string
}
}
}
request: Stripe.Event.Request
}
export type CustomerCreatedWebhookEvent = {
type: 'customer.created'
data: {
object: Stripe.Customer
}
}
export type CustomerSubscriptionWebhookEvent =
| CustomerSubscriptionUpdatedWebhookEvent
| CustomerSubscriptionCreatedWebhookEvent
@@ -101,3 +123,5 @@ export type WebhookEvent =
| InvoiceVoidedWebhookEvent
| PaymentIntentPaymentFailedWebhookEvent
| InvoiceOverdueWebhookEvent
| CheckoutSessionCompletedWebhookEvent
| CustomerCreatedWebhookEvent