#tgalanis_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/1267935737953779833
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Can you share the request id where this isn't working?
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
As well as your code
this is the checkout session cs_test_b1qkBenwflFjd3FBOov0xGd3ro1S9BOJBWkBCeBV5nPSkBdGndvQqxJ8Q0
Can you share the request id for the retrieval as well as your code
stripe.Key = os.Getenv(constants.ENV_STRIPE_SECRET_KEY)
params := &stripe.CheckoutSessionParams{
Expand: []*string{stripe.String("setup_intent")},
}
params.AddExpand("setup_intent")
checkout_session, err := session.Get("cs_test_b1qkBenwflFjd3FBOov0xGd3ro1S9BOJBWkBCeBV5nPSkBdGndvQqxJ8Q0", params)
if err != nil {
t.Error(err.Error())
return
}
That checkout session doesn't have a setupintent by the way
So it's null
That would be expected
seti_1PiIV9KZjqPsPSFtr8F4v3KF
this is the setup intent I see when I retrieve the session on the dashboard
stripe checkout sessions retrieve cs_test_b1qkBenwflFjd3FBOov0xGd3ro1S9BOJBWkBCeBV5nPSkBdGndvQqxJ8Q0 -d expand[0]="setup_intent"
this yields a setup intent in the cli
You ran that just now?
Can you share the request id?
Looking at the checkout session object I see null under setup_intent
nope in the cli I obtain a setup intent in the go code i don;t
pardon me what is the request id
That param is for checkout sessions in setup mode: https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-setup_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
that you ask?
That's a subscription checkout session
I will copy the response form the cli
or better have the event id
evt_1PiIVIKZjqPsPSFtMnACYS1p
give me a second
i will find it
req_LL9KKsniKjyyuR
indeed it does not have one
but the dashboard log for the same checkout session does
What do you mean by dashboard log?
And when did you make this request?
That's the request id I need
I mean in the events tab
in the dashboard
and you click the same event checkout_session.completed
it displays a setup intent
I see it in the event
But you're saying some requests are returning setup_intent and others aren't
I did it again now
What did it show?
it had the setup intent
Please share the request id
I dont think the cli generates logs
the last request that I have logged are the ones from the go test
which didnt have the setup intent
it should
That's a post request
I think that's different
I'm talking about the GET request you just made via the cli
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
yes could be but I sended yyou the last log that is diplayed in the dashboard
it was at this time
This is a checkout session creation request made in Go
It's fine
I'm looking into this with a colleague
yep that's the one I shared above
yeap this is from the stripe cli
i dint use go
so just to give you some context this was in mode subscription and I put a code fro 100% 7 months
after I provided the test card the setup intent was created
the subscription didnt have a trial attached to it just a 100%discount
for 7 months
Ah ok we found the reason. This is an API versioning thing. Your account's default api version (which is what the cli uses) is 2020-08-27. On 2022-08-01 we made a change that removes setup_intent from the response for Checkout sessions in Subscription mode: https://docs.stripe.com/upgrades#2022-08-01. Your Go sdk is pinned to version 2024-06-20, so that's why it's not returned there. You should be able to see the api versions used in the dashboard request log for each request.
so how will I be a ble to retrieve it
I want the payment method
I dont really care about the intent
but it is not saved in the subscription default method, I cant retrieve it from the invoice
and the customer does display a default payment method, source or whatever.
doesn't*
That's not true. Payment method is always set as the subscription's default if you used Checkout
And I see that's the case with the session you provided
I think the default subscription method becomes null if the customer changes his default payment
option
but you are correct this is not going to happen right after the session and I can collect the default payment from the webhook
If using the customer portal this is correct. That's because it sets it as default for all subscriptions (so sets it on the customer and unsets it on the individual subscriptions)
yea
sorry for the confusion
but i was working on this for many hours and lost track of waht i had tried and waht i did not
thank you for the help
No problem. Alternatively, you can force the api version for the retrieve checkout session request to be an earlier api version to get the setup intent
I believe this is not necessary I only need this to be able to update the subscription in the future
so from the checkout session I will retrieve it from the default payment method and set it to default for subscirptions since we allow only one at a time
and if the customer changes the data then at the update I will only fetch the method from the invoice settings and I am set
again thank you very much for the time