Reputation: 558
I’m using Stripe’s API to create two subscriptions for the same customer, and I need both to:
I've tried setting the billing_cycle_anchor
of the second subscription to match the first one's period end date. The subscriptions are created on different days rather than simultaneously.
builder = builder.setBillingCycleAnchor(new Date(firstSubscription.getCurrentPeriodEnd() * 1000).toInstant().getEpochSecond());
Despite these efforts, there's a slight delay in invoice creation. It's odd because the first set of invoices in December had the same creation date, but the subsequent pairs in January and February were created a day apart (as shown in the screenshot below).
My only hunch is that it might be related to timezones — for example, if the subscription's billing cycle is close to midnight UTC.
Upvotes: 0
Views: 40
Reputation: 26
I have tried to recreate the issue, but instead it actually worked for me. I have created two subscriptions for the same customer, and set the billing_cycle_anchor
to the same date.
If I understand you right, you used the current_period_end
date of the first subscription, and passed it in as the billing_cycle_anchor
of the second subscription? In that case the billing cycle of your second subscription on the last day of the billing cycle of the first subscription, meaning if the first subscription's current_period_end
date is 01/31/25, then the second subscription’s current_period_start
would be the same day, 01/31/25, which would explain the one day difference.
Upvotes: 0