#hash_api
1 messages Β· Page 1 of 1 (latest)
π Welcome to your new thread!
β²οΈ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
β±οΈ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
π This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1430983457340653810
π Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! working through some other issues at the moment but i will get back to you ASAP π
no problem i'll take a small break i'll be back in 15 minutes
ok! i am looking into this now
ok, so the issue here is that our golang SDK is typed, and since you've upgraded to the latest version of the SDK (which aligns with our most recent API release) it now also expects to receive events that match that API version
you have 3 options:
- Revert to the previous version of the golang SDK for now (probably the easiest and safest to do in the short run)
- Update the API version of your webhook endpoint to the new version. Note that our Clover releases contain many breaking changes compared to our Basil releases, so you'll want to review all of these and test your integration carefully before doing this.
- Ignore the API version mismatch as the error message suggests using
ConstructEventWithOptions(..., ConstructEventOptions{..., ignoreAPIVersionMismatch: true})
ineed to createa new webhook? i could ignore the error but the stripe.exe keeps getting 400 andthen fail actually
can you explain what you mean by stripe.exe failing? are you running your server from a .exe file? and is the 400 error just the one you shared previously?
yes, i'm just getting 400 onevery call so the database doesn't update but also it seems my schedule subscription now doesn't work very well. When i update the price and i have more than 5β¬ it used todebit automatically because i had configure the option but now it doesn't at all
prorationBehavior := stripe.String("create_prorations")
if currentMonthAmount-existingItems.TotalPrice > 300 {
prorationBehavior = stripe.String("always_invoice")
}
i had this which was suppose to make it work and the total price is at 27000 so its suppose to invoice immediatly with always_invoice no?
Hi π
I'm stepping in as my colleague needs to go. Give me a sec to cach up.
As my colleague explained, when you update your SDK version with Golang, you update the API version used in your integration. This is because Go's static typing means the SDK must match the specific properties of each Stripe object.
Because the change from .basil to .clover APIs represents a breaking change, I recommend you first review these details in our Changlog
yeah but i'm with the test environement at the moment and i thought updating the latest stripe cli and go package would work
and i thought updating the latest stripe cli and go package would work
Why?
i don't see any option in that dev interface as well to change to clover
because they are both aligned on the same API no? Are you publishing your latest version with different API?
Sorry those questions don't make any sense to me.
i don't see any option in that dev interface as well to change to clover
What dev interface are you referring to here?
github.com/stripe/stripe-go/v83 v83.0.2
thats what i have installed
v1.31.1 Latest andthis is my stripe.exe version
The Stripe Go SDK is maintained by Stripe but I'm not familiar with Stripe.exe.
i think the stripe.exe is reading some config somewhere maybe and its keeping old api
cause right now i'm testing the schedule subscription and its not working so well xD
Can you share a request ID for a request you are generating that is throwing an error?
Okay can you share that subscription scheduele ID?
and i updated because i had problems to see if latest version is a bit better
for exemple here
req_4cJxXLSSJwD3KI and req_6Lo5VvqtpPP0Cv
FYI: So as of v83.0.0, stripe-go is pinned to the API version 2025-09-30.clover
Great, thanks!
those where suppose to be an update of my subscription
this time it just created a new invoice completely
but with the same code later it did create the prorated element on the second call
Sorry I think you are mixing too many things up here.
Both of these requests confirm different payment intents
Both are successful. So you are paying a Payment Intent.
What is the problem here?
the problem was i was upgrading the same subscription. There was the initial subscription at 9β¬ and then i just went to add new items to it
No
it shouldn't have invoiced the user the 9β¬ but only the extra item added
If you are attempting to upgrade a subscription, please provide the API request to upgrade the subscription
I'm not seeing any problems with SDK/API versions, but instead it seems like there is some confusion about how Subscriptions work
its the use of the phase with var phases []*stripe.SubscriptionSchedulePhaseParams
if hasNextPhase {
phases = []*stripe.SubscriptionSchedulePhaseParams{
{
Items: currentPhaseItems,
ProrationBehavior: prorationBehavior,
},
{
Items: nextPhaseItems,
ProrationBehavior: stripe.String("none"),
/Duration: &stripe.SubscriptionSchedulePhaseDurationParams{
IntervalCount: stripe.Int64(1),
Interval: stripe.String("month"),
},/
},
}
} else {
phases = []*stripe.SubscriptionSchedulePhaseParams{
{
Items: currentPhaseItems,
ProrationBehavior: prorationBehavior,
},
}
}
this SubscriptionSchedule phase isn't consistent
Okay here is the request that created this Payment Intent: https://dashboard.stripe.com/acct_1RsYF0F8BVnhmF8J/test/logs/req_QIjpUxm1hKhkH5
You are creating a Subscription
the second call was suppose tobe a phase update, it created a full new subscription
Can you share the request ID for that request?
actually its weird why some request are made with Version de l'API
2025-09-30.clover
La plus rΓ©cente andother with Version de l'API
2025-08-27.basil
I'm looking at subscription sub_1SLRizF8BVnhmF8JTFiBWI1b. There are no update requests for this subscription and it is not managed by a schedule
just look at the history around the request i gave you req_wtPz7SrWl3Dd4U req_p7TDjbksppydOa req_6Lo5VvqtpPP0Cv
Are some requests from before you updated the SDK
I can't "just look at the history"
I'm looking at the related objects but the API calls you refer to aren't there
wellin the time line some get the basil version and later some clover
its not that at some point they are all clover
Then that is something in your integration, because this version is explicitly set
Also, I'm not seeing any errors specific to API versions. All I can find is Subscriptions related to payment intents and none of them have schedules.
At this point I need you to take a step back, identify what is the critical problem you need to solve to move forward with your integration, and clearly explain it.
i think that schedule subscription isn't so good, basic test in my code just checkingthe total amount and passing
prorationBehavior := stripe.String("create_prorations")
if currentMonthAmount-existingItems.TotalPrice > 300 {
prorationBehavior = stripe.String("always_invoice")
}
doesn't work as well
the card is not debited right away and the total price is at 2700
You haven't provided me any evidence you are using Subscription schedules, so I can't help with that
None of the Subscriptions associated with those Payment Intents have schedules associatd with them
req_FXVvr8kOsOSkAX
Okay, we've got a update to a schedule! Now, what is it you are trying to do with this API request?
i'll need to find the scenario again, because i have too many logs right now. I upgraded my version because the always_invoice wasn't working this week with the code that used to works 3 weeks ago
but with that new version the stripe.exe doesn't want to reset the api version and is stuck on the old one. I guess i need to fix this first then run again my test to give you the requests id generated
but first i need to see where in the stripe.exe i can set the api version cause i think its him screwing up the other calls
Ready! You are using Stripe API Version [2025-07-30.basil]. Your webhook signing secret is whsec_10ece625fb73a293bf3b61dad7eed32b5782d4ca7cd818331aaf23ba85d74284 (^C to quit)
cause it doesn't switch the version there
Can you please describe what you expected to happen as a result of this request?
SDK/API versions would not impact the behavior of proration_behavior parameter
i had a subscription for 9β¬. I added 27β¬ to that subscription i was expecting the 27β¬ to be paid immediatly
Okay, now we are on to a clear description.
instead it was schedule to be paid on the next invoice
You are updating the phase in place
Rather that stopping the current phase and starting a new one
but i had no phase at first it was a normal subscription, the new phase is suppose to update the parameter immediatly and schedule for next month, the call worked and my subscription got updated
but the payment wasn't made
it was added to the next month
You created a phase in this request: https://dashboard.stripe.com/acct_1RsYF0F8BVnhmF8J/test/logs/req_37drBZ6kRpthfi
the flow itself with the new subscription worked
The way Subscription Schedules work, you need to pass in the current phase in addition to any future phases. This even includes situations where you want to replace the current phase with a new one.
the flow itself with the new subscription worked
What flow do you mean?
the fact that the suscription for the 27β¬ worked means the schedule did what it was suppose to do
but it didn't make the immediate payment
the subscription itself was correctly updated
"always_invoice" <- this option when pass should make an immediate payment no?
You made a change directly to an existing phase, rather than end that phase and start a new one. Because you are updating that phase directly, you need to specify the proration_behavior parameter on the phase itself: https://docs.stripe.com/api/subscription_schedules/update?api-version=2025-09-30.preview&rds=1#update_subscription_schedule-phases-proration_behavior
Oh wait, no π€¦ββοΈ the other way around
I'm thinking i overcomplicated my subscription xD
You passed proration_behavior inside the phase.items
maybe i should just make somekind of plan 1 and plan 22
If you want to update your Subscription immediately and not schedule future changes
plan2*
Then just using the Subscription itself makes more sense
Phases get really complicated
and just let the user switch between them. right now i have different object but its not in the plan itself
yeah the problem was that i had a few options and wanted user to be able to just switch but maybe keeping things just on stripe side with their own screen and just listening to hook could simplify things
Sorry that's not clear enough for me to understand what you are trying to do. Can you describe your integration in terms of Stripe APIs?
i'm using a golang backend and react frontend.
I have 4 products 2 are subscription offers. 2 are usage base elment (users, storage)
the subscription are 9β¬ and 27β¬ and you can activate or desactivate them as you please
Right now to try to keep everything under one monthly invoice, i made some code that check if a subscription is already made and when changes are made i update the subscription with the new object, and if the price of the new added items are more than 3β¬ i invoice immediately.
If the user remove some element i let him use the removed element until the end of the month then make the schedule remove those object for the next payment so he doesn't pay them again but still keep the things he paid on the first invoice
my goal was to always have only one invoice per customer with the prices being prorated when he add something during the month
and not being reimbourse if he remove an option but only have it still be available until the end of the current payment period
also i'm trying this with my golang file but
// Only beta releases of stripe-go support setting API version. See stripe.APIVersion = "2025-09-30.preview"
my go doesn't want me to change the apiversion this way π
stripe-go is pinned to a specific API version for every major SDK version.
Is it possible some part of your code is loading an older SDK version?
no i centralised everything related to stripe in one file but i'm using docker, its suppose to have loaded the latest version but i know sometime it does shit x_x
Might need to rebuild and restart your docker image?
i tried a few time but i guess i'll try to see if i can change the stripe.exe options too
- What OS are you running on your docker container?
- Where is this stripe.exe file coming from?
windows
Hmmm.... π€
I've run into issues with other SDKs (mostly PHP) on Windows before ....
Have you tried running the code in a Linux container?
Okay, that's the stripe CLI. Are you saying this is what is making the other API requests?
This will use your Account's default API version
well when i run it its saying that its listening for basil
but i don't think it should be making request, its suppose to only receive events from what i udnerstood
Yeah, because it's pinned to your account default version
IT doesn't make requests, no
But if you use stripe trigger or other commands, it will make API requests and those will use the account default basil API version
i'm not triggering things with it normally, i was using it only to test the phase ending to update the subscription i have
but in my account i don't see where to switch that default i thought that the golang package would have done it automatically
Changing the SDK does not change the defaults set on your account
It explicitly sets the API version in the code itself
ok so here i created a subscription req_2xmQ10e2jNt3WG
or no its here (req_cKwMK5cYaAWC9c) previous was an old request
then confirmed req_3rFInQ6SaC6A0Z
then i updated to get the 27β¬ more req_HEipwsH1SWRrqj and req_mGNbYhwsRoWmZ7
and the 27β¬ isn't being paid immediately but schedule on the next invoice
https://dashboard.stripe.com/acct_1RsYF0F8BVnhmF8J/test/subscriptions/sub_1SLUVZF8BVnhmF8Jpkr5hM0Z not sure if you can see the page
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hello, my colleague has to step out but I can help. If you want to charge for that 27 immediately, you can pass proration_behavior='always_invoice' when making the subscription schedule update call. By default that parameter is create_prorations which is the behavior that you are seeing: create proration items now but don't immediately create an invoice for them.
but as you can see in my last schedule req_mGNbYhwsRoWmZ7 the "proration_behavior":
"always_invoice",
is there
Ah I was going to get to that next. So there are actually two separate proration_behavior parameters here. The one I linked to sets it for the API call, so it applies to any prorations actually generated by the call. The one your call uses is actually the proration_behavior for the phase so it only covers what happens when the phase starts.
becuase my problem is some element are cheap like 0.67β¬ and i didn't want it to be invoide immediately if its not above 3β¬
So if you pass that same value at the top level of your API call it should start working like you want.
so i always check on the last change if the amount is above 3β¬ i change it to immediately if its not i leave it for next xcycle
Gotcha, so yeah when it is >3 you can pass that param at the top level of the call.
but mmh prorationBehavior := stripe.String("create_prorations") if currentMonthAmount-existingItems.TotalPrice > 300 { prorationBehavior = stripe.String("always_invoice") } /*h.Log.Info("******currentMonthAmount", zap.Int64("currentMonthAmount", currentMonthAmount), zap.Int64("existingItems.TotalPrice", existingItems.TotalPrice), zap.Int64("prorationBehavior", currentMonthAmount-existingItems.TotalPrice), zap.String("prorationBehavior", string(*prorationBehavior)), )*/ var phases []*stripe.SubscriptionSchedulePhaseParams if hasNextPhase { phases = []*stripe.SubscriptionSchedulePhaseParams{ { Items: currentPhaseItems, ProrationBehavior: prorationBehavior, }, { Items: nextPhaseItems, ProrationBehavior: stripe.String("none"), /*Duration: &stripe.SubscriptionSchedulePhaseDurationParams{ IntervalCount: stripe.Int64(1), Interval: stripe.String("month"), },*/ }, } } else { phases = []*stripe.SubscriptionSchedulePhaseParams{ { Items: currentPhaseItems, ProrationBehavior: prorationBehavior, }, } }
isn't that somehow what is being done? for the phase to be changed? i pass the new proration there
and in my case i see it being passed but its not being executed or i don't understand where i need to pass it if its not inside the phase itself
because this request req_mGNbYhwsRoWmZ7
show me that it is at the correct behaviour but it just wasn't done
The thing to keep in mind here is that the proration behavior of a phase only applies when the phase begins. In your case, the first phase is already active, so setting a proration behavior there won't do anything because the phase has already begun.
What you are trying to do is create prorations right now with this API call, so you need to take the proration behavior that you are setting in the phase and move it outside of the phases to the top level of the API call's params.
so like in the scheduleParams itself?
Exactly!
mmmh ok it seems to have billed it but its in draft mode the invoice at the moment
Can you send me the in_ ID? I think it should auto-finalize after an hour or you can finalize it programmatically with the API
in_1SLUwiF8BVnhmF8J6qNvGvxQ
yeah okay i see it
its fine i guess, i need to make my UI better cause its making me open a blank page atm
Yep yep, just tested and confirmed it automatically finalizes after an hour. I'm a bit surprised because when updating the subscription directly the invoice finalizes automatically. Not sure why they work differently but I guess they just do π€·