#paulc7053_api

1 messages · Page 1 of 1 (latest)

obtuse falconBOT
#

👋 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/1357754646449361047

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

scenic musk
#

Hi again! Not 100% sure I understand what you mean here; can you tell me more?

polar flicker
#

Hello again! Sure. I'm trying to create 2 test accounts in production (to submit an app for review), but when I create the second subscription (and customer), it seems like I cannot find the user's subscriptions. Logs look like this { customer: { id: 'cus_S4LOdAvqBBsA2u', object: 'customer', address: null, } }

#

These are the user's subscriptions { subscriptions: { object: 'list', data: [ [Object] ], has_more: false, url: '/v1/subscriptions' } }

#

But none seem to match the payment intent { subscription: undefined }

#

Sorry setup Intent

#

and the setup intent is `{
setupIntent: {
id: 'seti_1RAChpJ4ILijjURSTucDEV7l',
created: 1743782577,
customer: 'cus_S4LOdAvqBBsA2u',

}
}`

#

Okay, sorry for blasting all that, I made them shorter

scenic musk
#

I mean, you can never take back that wall of text. 😂 No worries. 🙂

#

data: [ [Object] ],

polar flicker
#

really? arent the updates I see in real time?

scenic musk
#

Sorry, what?

polar flicker
scenic musk
#

Oh, it is. It was a joke.

polar flicker
#

aah okay 🙂

scenic musk
#

A bad joke, it seems. ¯_(ツ)_/¯

polar flicker
#

im just bad at picking them sometimes

scenic musk
#

data: [ [Object] ],

So that contains a result, which should be that Subscription.

Am I correct in assuming you are just trying to retrieve all the Subscriptions for a Customer?

polar flicker
#

yes

#

and then // try to match the setup intent const subscription = subscriptions.data.find( (sub) => sub.pending_setup_intent === setupIntent.id );

#

but none seem to match the setup intent.. which is weird

scenic musk
#

What does the Setup Intent have to do with this exactly?

polar flicker
#

I retrieve the user's subscription based on the setup intent id in the sent event

scenic musk
#

Which event?

polar flicker
#

setup_intent.succeeded

#

to be noted that it works as expectd when I usually sign up. it behaves unexpected when I create the second subscription/customer with the same card

scenic musk
#

Can you share the second Customer ID with me?

polar flicker
#

it's cus_S4LOdAvqBBsA2u

scenic musk
#

Oh! You wouldn't have a SetupIntent with the second Subscription because the card is already set up.

#

Huh

polar flicker
#

really? but the event was sent

scenic musk
#

Sorry, I got confused.

polar flicker
#

no worries

scenic musk
#

Do you not record the Subscription ID when you create it? I'm just trying to understand why you're using the Setup Intent like this.

polar flicker
#

I do, but I just need to retrieve the stripe subscription in this event.

#

i need to read the metadata here, and I cannot change the flow

#

everything looks as expxcted in the dashboard, but no subscription matches the payload setup intent ID

#

Okay I really have to go... The building closes. I'll come back to this in a few hours....

#

Thanks for your time!

scenic musk
#

No worries - I'll have to close this one out but you can pop open a new thread when you get back. 🙂

polar flicker
#

Actually

#

I am on my phone

#

We can continue this

scenic musk
#

Nice, ok.

#

So you have a Setup Intent, and you want to figure out which Subscription it relates to, ya?

polar flicker
#

Yep

#

But it doesn’t match any subscription

scenic musk
#

Sweet. And that's sub_1RAChoJ4ILijjURS3k7KD7hM ya?

polar flicker
#

Yes

scenic musk
polar flicker
#

That’s correct

#

But by the same logic shouldn’t the setup intent also work?

#

I would even be inclined to believe the payment method Id could be even more problematic, because I’m using the same card, no?

obtuse falconBOT
scenic musk
#

No, because once the Setup Intent is no longer pending, it's no longer a pending_setup_intent.

#

Each Payment Method ID is globally unique (across Stripe).

polar flicker
#

I see!

#

Will try this asap, thanks a lot again @scenic musk !

scenic musk
#

You're very welcome! 🙂