Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

packy's avatar
Level 7

Stripe Ignoring billing_cycle_anchor when creating subscription and billing right away

I am creating a subscription with a billing cycle anchor via the Stripe PHP library but it bills the customer immediately for the full price. I checked the timestamp and its correct so why doesnt Stripe honor the anchor?

$stripeSubscription = \Stripe\Subscription::create([
            'customer' => $stripeCustomer['id'],
            'items' => [['price' => $subscription->subscription_type->stripe_id]],
            'billing_cycle_anchor' => Carbon::now()->addDays($subscription->subscription_type->days)->timestamp
        ]);

The Carbon code produces the timestamp 1631717820. I also tried

$stripeSubscription = \Stripe\Subscription::create([
            'customer' => $stripeCustomer['id'],
            'items' => [['price' => $subscription->subscription_type->stripe_id]],
            'billing_cycle_anchor' => 1631717820
        ]);

Whats happening???

0 likes
0 replies

Please or to participate in this conversation.