#ibgoldbergs-schedule-metadata
1 messages ยท Page 1 of 1 (latest)
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.
- ibgoldbergs, 1 day ago, 30 messages
- ibgoldbergs, 4 days ago, 38 messages
- ibgoldbergs, 6 days ago, 15 messages
- ibgoldbergs-subscriptions, 6 days ago, 28 messages
I don't believe there's a way to set metadata directly on the subscription, the only workaround I can think of is to create a subscription prior to creating a schedule
and then use the Create Schedule API along with from_subscription parameter
https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-from_subscription
Hmm. We tried this route, but when we created the schedule with one phase AFTER we created the subscription, for some reason there were two phases in the schedule and it didnt seem to work as intended.
Seems odd that theres this limitation of not being able to write metadata to the subscription
Yeah part of the reason is that the subscription might not get created right away (not until the schedule begins)
The other option could be to listen to webhooks and update the subscription object separately by calling the API
Yeah but when the subscription is created, it should be able to support metadata out of the box. A bit confused about this limitation still.
I can file a feature request ๐
You can file it too by writing in https://support.stripe.com/?contact=true
Are you able to look at a test mode subscription and tell me why there are two phases on this subscription? sub_1OK38BFNVbYFceRMCTWMcDer
Basically I was thinking we could create the subscription withoutout a phased schedule but with the proper metadata and then update the subscription with a 1 phase schedule. However, whenever we did this, it resulted in two phases on the schedule instead of the one we sent.
hmm not sure, it seems like the call to create the schedule with from_subscription parameter generated two phases automatically
yeah but it seems wrong because we were just creating one phase on the schedule
this might be expected, asking a colleague to take a look too.
We will respond as soon as we have something
thanks
Looks like the subscription was in a trial period when the schedule was created
so the API seem to have created one phase for the trial period, and then one phase for the remainder of the Subscription.
Yeah. End result of what we want:
- 1 phase on the subscription schedule that is a trial
- schedule end behavior = cancel
Is there a better way for us to do this?
Maybe create a subscription that is scheduled to start in the future and then update it with a schedule that will move it to trialing
Btw, this problem is related to this thread: #1181963312943091742 message
Hello, hanzo had to step out, catching up here....
Thanks @undone terrace
I'm sorry but I'm still having trouble wrapping my head around your intended behavior here. Is the goal just to have a trialing subscription with a schedule and metadata set on the subscription?
End goal:
- Create a subscription with metadata on the subscription
- Have one phase on the subscription schedule that is trialing
- End behavior of the schedule is to cancel subscription
And the issues that we are running in to are that schedules don't support metadata, and creating a schedule from a trialing subscription creates two phases?
Yeah I tried both routes, and those were the issues. So I have not yet been able to achieve my goal
Gotcha, unfortunately I think those are the two best routes here. You'll basically need to create one and then modify the other. So either create a subscription, then create the schedule, then remove the schedule's first phase. Or create the schedule and then directly update the subscription to add metadata
Wait hold on, have you tried setting metadata on the subscription's phases https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-phases-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Apologies I was going to fast and thought that we had already tried it but am not seeing it brought up in the thread. I think that that param should set metadata on the subscription itself.
hmm let me check about this
Nice! Sorry we initially missed that
ended up just being like this:
{
"customer": "cus_P8DcntHrRM35Jc",
"default_settings": {
"collection_method": "charge_automatically",
"on_behalf_of": "acct_1GBmQYJxD7Yve411"
},
"end_behavior": "cancel",
"expand": {
"0": "subscription"
},
"phases": {
"0": {
"end_date": "1702213200",
"items": {
"0": {
"price": "price_1IEJh4FNVbYFceRMMvoqZPF8"
}
},
"metadata": {
"ovaid": "ovaid-98264017-d154-4bd9-98e5-05be5aeadffa",
"ovpid": "5319",
"partner name": "Tutones Custom AV",
"source": "ov-api",
"type": "Membership"
},
"trial_end": "1702213200"
}
},
"start_date": "now"
}
Nice! Thanks for sharing