#hash_api

1 messages Β· Page 1 of 1 (latest)

marble idolBOT
#

πŸ‘‹ 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.

hazy atlas
#

hello! working through some other issues at the moment but i will get back to you ASAP πŸ™

thorn eagle
#

no problem i'll take a small break i'll be back in 15 minutes

hazy atlas
#

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:

  1. Revert to the previous version of the golang SDK for now (probably the easiest and safest to do in the short run)
  2. 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.
  3. Ignore the API version mismatch as the error message suggests using ConstructEventWithOptions(..., ConstructEventOptions{..., ignoreAPIVersionMismatch: true})
thorn eagle
#

ineed to createa new webhook? i could ignore the error but the stripe.exe keeps getting 400 andthen fail actually

hazy atlas
#

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?

thorn eagle
#

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?

marble idolBOT
faint linden
#

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

thorn eagle
#

yeah but i'm with the test environement at the moment and i thought updating the latest stripe cli and go package would work

faint linden
#

and i thought updating the latest stripe cli and go package would work

Why?

thorn eagle
#

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?

faint linden
#

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?

thorn eagle
#

thats what i have installed

#

v1.31.1 Latest andthis is my stripe.exe version

faint linden
#

The Stripe Go SDK is maintained by Stripe but I'm not familiar with Stripe.exe.

thorn eagle
#

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

faint linden
#

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?

thorn eagle
#

and i updated because i had problems to see if latest version is a bit better

#

for exemple here
req_4cJxXLSSJwD3KI and req_6Lo5VvqtpPP0Cv

faint linden
#

FYI: So as of v83.0.0, stripe-go is pinned to the API version 2025-09-30.clover

#

Great, thanks!

thorn eagle
#

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

faint linden
#

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?

thorn eagle
#

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

faint linden
#

No

thorn eagle
#

it shouldn't have invoiced the user the 9€ but only the extra item added

faint linden
#

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

thorn eagle
#

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

faint linden
thorn eagle
#

the second call was suppose tobe a phase update, it created a full new subscription

faint linden
#

Can you share the request ID for that request?

thorn eagle
#

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

faint linden
#

I'm looking at subscription sub_1SLRizF8BVnhmF8JTFiBWI1b. There are no update requests for this subscription and it is not managed by a schedule

thorn eagle
#

just look at the history around the request i gave you req_wtPz7SrWl3Dd4U req_p7TDjbksppydOa req_6Lo5VvqtpPP0Cv

faint linden
#

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

thorn eagle
#

wellin the time line some get the basil version and later some clover

#

its not that at some point they are all clover

faint linden
#

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.

thorn eagle
#

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

faint linden
#

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

thorn eagle
#

req_FXVvr8kOsOSkAX

faint linden
#

Okay, we've got a update to a schedule! Now, what is it you are trying to do with this API request?

thorn eagle
#

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

faint linden
#

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

thorn eagle
#

i had a subscription for 9€. I added 27€ to that subscription i was expecting the 27€ to be paid immediatly

faint linden
#

Okay, now we are on to a clear description.

thorn eagle
#

instead it was schedule to be paid on the next invoice

faint linden
#

You are updating the phase in place

#

Rather that stopping the current phase and starting a new one

thorn eagle
#

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

faint linden
thorn eagle
#

the flow itself with the new subscription worked

faint linden
#

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?

thorn eagle
#

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?

faint linden
#

Oh wait, no πŸ€¦β€β™‚οΈ the other way around

thorn eagle
#

I'm thinking i overcomplicated my subscription xD

faint linden
#

You passed proration_behavior inside the phase.items

thorn eagle
#

maybe i should just make somekind of plan 1 and plan 22

faint linden
#

If you want to update your Subscription immediately and not schedule future changes

thorn eagle
#

plan2*

faint linden
#

Then just using the Subscription itself makes more sense

#

Phases get really complicated

thorn eagle
#

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

faint linden
#

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?

thorn eagle
#

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 πŸ˜„

faint linden
#

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?

thorn eagle
#

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

faint linden
#

Might need to rebuild and restart your docker image?

thorn eagle
#

i tried a few time but i guess i'll try to see if i can change the stripe.exe options too

faint linden
#
  1. What OS are you running on your docker container?
  2. Where is this stripe.exe file coming from?
thorn eagle
#

windows

faint linden
#

Hmmm.... πŸ€”

I've run into issues with other SDKs (mostly PHP) on Windows before ....

#

Have you tried running the code in a Linux container?

thorn eagle
faint linden
#

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

thorn eagle
#

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

faint linden
#

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

thorn eagle
#

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

faint linden
#

Changing the SDK does not change the defaults set on your account

#

It explicitly sets the API version in the code itself

marble idolBOT
thorn eagle
#

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

gusty saddle
#

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.

thorn eagle
#

but as you can see in my last schedule req_mGNbYhwsRoWmZ7 the "proration_behavior":
"always_invoice",

#

is there

gusty saddle
#

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.

thorn eagle
#

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€

gusty saddle
#

So if you pass that same value at the top level of your API call it should start working like you want.

thorn eagle
#

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

gusty saddle
#

Gotcha, so yeah when it is >3 you can pass that param at the top level of the call.

thorn eagle
#

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

gusty saddle
#

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.

thorn eagle
#

so like in the scheduleParams itself?

gusty saddle
#

Exactly!

thorn eagle
#

mmmh ok it seems to have billed it but its in draft mode the invoice at the moment

gusty saddle
#

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

thorn eagle
#

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

gusty saddle
#

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 🀷