'Stripe Subscription Schedule Testing
1:How can I test and trigger subscription scheduled.
$plan = Plan::create([
'currency' => $currency,
'interval' => 'day',
'product' => $product,
'amount' => $amount
]);
$schedule = SubscriptionSchedule::create([
'customer' => $customer_id,
'start_date' => 'now',
'end_behavior' => 'release',
'phases' => [
[
'plans' => [
[
'price' => $plan->id,
'quantity' => 1,
],
],
'iterations' => 3,
'collection_method'=> 'charge_automatically'
],
],
]);
return $schedule;
So I create a subscription today, how I can test. Also when creating plan we can only specify billing frequency as either day, week, month or year.
Have already tried updating subscription Id with params
setting trial_end: Few seconds from now
prorate: false
But this creates invoice for the same month. Also its creates another invoice with amt:0.(Dont know why it created).
2: Is this the same approach for testing subscription schedule.
Solution 1:[1]
I use Stripe's Test Clocks. Basically you simulate progress of time by setting a date and time in the future in order to make your subscriptions happen. Unfortunately you cannot use your existing Test Subscriptions and Customers but you have to create them just for the specific simulation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Pietro |
