Fetch all the subscriptions when backfilling user ids (#29005)

GitOrigin-RevId: 07c091176e50cad250e6bb4dea94fa3424643fd2
This commit is contained in:
Liangjun Song
2025-10-13 09:01:34 +01:00
committed by Copybot
parent 293157149e
commit b03b1e3bfc
2 changed files with 8 additions and 0 deletions

View File

@@ -80,6 +80,12 @@ async function processSubscription(
// Get customer details to check current metadata
const customer = subscription.customer
if (customer.deleted) {
if (verbose) {
console.info(`Customer ${customer.id} is deleted, skipping`)
}
return
}
if (customer.metadata?.userId === adminUserId) {
if (verbose) {
@@ -164,6 +170,7 @@ async function main(trackProgress) {
const listParams = {
limit: 100, // Stripe's maximum limit per request
expand: ['data.customer'], // Expand customer data to reduce additional API calls
status: 'all', // Include subscriptions in all statuses (active, past_due, unpaid, canceled, etc.)
}
let hasMore = true

View File

@@ -143,6 +143,7 @@ async function main(trackProgress) {
const listParams = {
limit: 100, // Stripe's maximum limit per request
status: 'all', // Include subscriptions in all statuses (active, past_due, unpaid, canceled, etc.)
}
let hasMore = true