Sep 1, 2021
0
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???
Please or to participate in this conversation.