0
votes

We already have existing stripe customers, they have already paid the amount on different dates.

Now we would like to create a subscription option for those customers for recurring payments. But the problem is, it is charged immediately after the creation of the subscription. It is not considering the billing_cycle_anchor timestamp.

Sample code of subscription that I am using.

$stripe_subscription_response   =   $stripe->subscriptions->create([
            'customer'                  =>  $stripe_profile_id,
            'default_payment_method'    =>  $payment_method_id,
            'billing_cycle_anchor'      =>  $due_date_time_stamp, //Upcoming due date timestamp
            'items' => [
                ['price' => $stripe_price_info->id],
            ],
        ]);

Is there any way to stop the amount charge? while creating a subscription.

I have seen the below answer. Stripe charges twice every time i create a new customer and post a charge

1

1 Answers

1
votes

That's the expected behaviour :

https://stripe.com/docs/billing/subscriptions/billing-cycle#new-subscriptions

A request like that will charge the customer upfront for a prorated amount of the pricing plan, from the time of the API request to billing_cycle_anchor.

If you don't want them to be charged yet you could either pass 'proration_behavior' => 'none' on that request, or set 'trial_end' => $due_date_time_stamp instead of setting the anchor directly. Either approach avoids charging the customer(the latter creates a $0 invoice, the former doesn't).