-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[11.x] Multiplan swapping #915
Conversation
Upon looking at this I'm wondering if there was a significant reason you decided not to let plan options be specified in the first argument plan array... |
@taylorotwell we definitely could do that. No specific reason. I'll update the PR on Monday 👍 |
@driesvints This is great! Thanks so much for putting this together so quickly. I do wonder about the utility about the multiplan swap on a subscription, as in these functions: $subscription->swap(['new-plan', 'other-plan']);
$subscription->swapAndInvoice(['new-plan', 'other-plan']); As an example, suppose I have the following set of plans: Now, suppose that I would like to switch For the above example, it would be great if I could specify the "from" and "to" plans of each swap eg.: $subscription->swap([
'plan_a' => 'plan_b',
'plan_a_addon1' => 'plan_b_addon1',
'plan_a_addon2' => 'plan_b_addon2',
]); The above method is more of a convenience, since I can still do the above swap by swapping on each subscription item individually. However, I don't quite see how the current |
@Xenonym I actually think your use case is less common. If you need to persist data between plans it's probably best that you explicitly provide that in the options. Or do a swap on the item itself like you said. In my opinion you'll always want new subscription item records when changing to a new plan. Opinions may differ here maybe. |
Stripe confirmed that the more common scenario is to deleted old subscription items and to create new ones so I'm going to leave the PR as is :) |
@driesvints it's cool :) Like you said, I can do the swaps on the subscription items themselves anyway - this PR is good enough for my use! |
This PR adds support for multiplan swapping.
Any old plan which isn't in the list during swapping will be removed from the subscription. Any existing plan will be kept.
You also swap individual subscription items:
Closes #912