#Min.K

1 messages · Page 1 of 1 (latest)

summer sphinxBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

  • Min.K, 2 days ago, 17 messages
  • Min.K, 2 days ago, 9 messages
  • Min.K, 3 days ago, 12 messages
  • Min.K, 4 days ago, 4 messages
  • Min.K, 4 days ago, 5 messages
  • Min.K, 6 days ago, 27 messages
    and 1 more
gleaming osprey
#

Question 1. If I do it like above, is it correct that it will change to a new item at the end of the current subscription cycle?

Question 2. It looks like I need to call the SubscriptionSchedule Create API first and then the Update API. Is it possible to achieve the above goal by calling only one Subscription Create API? It’s cumbersome to call the Create API and then call the Update API once more.

Question 3. I was instructed to pass pahse[1].prorate as true, but when I look at the Subscription Schedule Update API documentation, there is no prorate parameter, so what should I do?

Question 4. What happens if I make multiple calls to the Create Subscription API with the same subscription identifier in the from_subscription parameter? I'm wondering if nothing actually happens if I only pass the from_subscription parameter when calling the Create Subscription API. That said, I'm wondering if it's okay to have garbage in the Subscription Scheduler.

Question 5. Let's say I have a subscription identifier A. That subscription is currently subscribing to a product called Gold. I want to implement a business that will change the product from Gold to Silver after the end of this subscription cycle. For this I want to create a Subscription Scheduler. I was wondering what happens if a subscription schedule is registered multiple times for the same subscription A? I ask because while updating a Subscription Schedule, a retry may occur due to a network timeout, causing the Subscription Schedule to be registered twice.

Question 6. How do I know if a subscription schedule with the same content is registered for subscription A? I want to prevent more than one subscription update request from being registered for the same subscription without my intention. How do I know if a subscription schedule with the same content is already registered?

#

Here is Sample Flow

1. Register a subscription schedule for subscription A (First Time)
$sched = \Stripe\SubscriptionSchedule::create([
  'from_subscription' => $subscription->id,
]);

\Stripe\SubscriptionSchedule::update($sched->id, [
  'phases' => [
    [
      "start_date" => $subscription->current_period_start,
      "end_date" => $subscription->current_period_end,
      'items' => [
        [
          'price' => $gold->id,
          'quantity' => 1,
        ],
      ]
    ],
    [
      "start_date" => $subscription->current_period_end,
      'items' => [
        [
          'price' => $silver->id,
          'quantity' => 1,
        ],
      ],
    ],
  ],
  "end_behavior" => "release"
]);

2. Register a subscription schedule for subscription A (Second Time - Retry)
$sched = \Stripe\SubscriptionSchedule::create([
  'from_subscription' => $subscription->id,
]);

\Stripe\SubscriptionSchedule::update($sched->id, [
  'phases' => [
    [
      "start_date" => $subscription->current_period_start,
      "end_date" => $subscription->current_period_end,
      'items' => [
        [
          'price' => $gold->id,
          'quantity' => 1,
        ],
      ]
    ],
    [
      "start_date" => $subscription->current_period_end,
      'items' => [
        [
          'price' => $silver->id,
          'quantity' => 1,
        ],
      ],
    ],
  ],
  "end_behavior" => "release"
]);
proper bobcat
#

If I do it like above, is it correct that it will change to a new item at the end of the current subscription cycle?
The code example seems to have an initial phase with the 'gold' item with a specified end date yes. Then we transition to the next phase with 'silver' item

It looks like I need to call the SubscriptionSchedule Create API first and then the Update API. Is it possible to achieve the above goal by calling only one Subscription Create API? It’s cumbersome to call the Create API and then call the Update API once more.
Not if you have an existing sub_xxx that you want to be controlled by a schedule. You'd create then update first

I was instructed to pass pahse[1].prorate as true, but when I look at the Subscription Schedule Update API documentation, there is no prorate parameter, so what should I do?
Do you want to prorate when that phase starts? I think correct param is: https://stripe.com/docs/api/subscription_schedules/object#subscription_schedule_object-phases-proration_behavior

What happens if I make multiple calls to the Create Subscription API with the same subscription identifier in the from_subscription parameter? I'm wondering if nothing actually happens if I only pass the from_subscription parameter when calling the Create Subscription API. That said, I'm wondering if it's okay to have garbage in the Subscription Scheduler.
The sub_xxx can only be controlled by a single schedule, so it'd error. Should be easy to test!

#

Let's say I have a subscription identifier A. That subscription is currently subscribing to a product called Gold. I want to implement a business that will change the product from Gold to Silver after the end of this subscription cycle. For this I want to create a Subscription Scheduler. I was wondering what happens if a subscription schedule is registered multiple times for the same subscription A? I ask because while updating a Subscription Schedule, a retry may occur due to a network timeout, causing the Subscription Schedule to be registered twice.
I think I just answered that above – the API request will error

How do I know if a subscription schedule with the same content is registered for subscription A? I want to prevent more than one subscription update request from being registered for the same subscription without my intention. How do I know if a subscription schedule with the same content is already registered?
There's a schedule field on the Subscription object: https://stripe.com/docs/api/subscriptions/object#subscription_object-schedule

gleaming osprey
#

Thank you so much!

#
How do I know if a subscription schedule with the same content is registered for subscription A? I want to prevent more than one subscription update request from being registered for the same subscription without my intention. How do I know if a subscription schedule with the same content is already registered?
=> There's a schedule field on the Subscription object: https://stripe.com/docs/api/subscriptions/object#subscription_object-schedule

=> I'm trying to create a subscription with the Checkout Session API.

At this time, what should I do to automatically create a Subscription Schedule?

#

I would like to create an empty subscription schedule in advance.

proper bobcat
#

Checkout doesn't support schedules