#leedurrant_docs

1 messages ยท Page 1 of 1 (latest)

analog thistleBOT
#

๐Ÿ‘‹ 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/1403028505930891315

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

thorny crow
#

Hi, you're likely using https://docs.stripe.com/api/payment_intents/search and payment method is not supported there: https://docs.stripe.com/search#query-fields-for-paymentintents

You can leverage the metadata in this case and then use that in the Search API. Alternatively, you can also retrieve the PaymentMethod on the customer, https://docs.stripe.com/api/payment_methods/customer . However, as you scale it is recommended that you store that data on your end and then query your internal data.

fossil veldt
#

I am getting the PaymentMethod when it is created, and trying to figure out if it is off_session. Its a shame that this isnt included in the PaymentMethod json.

Thanks for the link to query-fields-for-paymentintents. Is there anything similar for setupintents? It makes more sense to go direct to the setupintent that created the paymentmethod, but I want to confirm that this (being able to filter on paymentmethod) isnt just a bug.

By leveraging metadata, I presume that you mean add a uniqueidentifier to the metadata of the setupintenet and paymentintent, and search for the setupintent or paymentintent with this identifier. Does that identifier flow through to the metadata of the payment_method?

thorny crow
#

There is not a Search API for SetupIntents no.

#

You can search the metadata in the payment intent

#

No, the metadata won't be shared with other objects like payment methods.

fossil veldt
thorny crow
fossil veldt
#

Because for each paymentmethod that it returns, I still have to find the setupintent or paymentintent that created it to see whether usage=off_session

#

God knows why it cant return usage along with the paymentmethod json, but it doesnt

thorny crow
#

I see.. As you scale, I highly recommend that you store that information on your end, and the pass the payment method that you know has off_session usage.

fossil veldt
#

My app gets a webhook that a pm has been created, so I grab the details and have to also grab the paymentintent or setupintent

#

I am trying to store this, and trying to find an efficient way to find the data. But as I dont know the exact pi or si that created it, I have been filtering by cus and created datetime (adding time either side). The code has been there for years, but for one of my customers (Australia) it has just stopped working.

thorny crow
#

When you create the SetupIntent or the PaymentIntent, you're passing that data so you already have that data on your end

#

You can store that in the metadata at the same time

fossil veldt
#

Understood if I were creating the setupintent or paymentintent, but what about if it was created elsewhere and I dont have this data?

thorny crow
#

What would 'created elsewhere' be so I can accurately assist?

fossil veldt
#

When I use the paymentintent route, the user has the option to "Save Card". Therefore I create two payment intents and they essentially chose which one to use. So I have to find both and see which one succeeded, and grab the usage from it.

#

'created elsewhere' another app that has asked the payer if they want to store their card on the account. Perhaps from their webshop.

thorny crow
#

Another app? You would not be able to access those as those do not belong to your account.

#

Can you share an example here?

fossil veldt
#

My app connects to a Stripe Account. The objects in that Stripe Account are accessible. For example, a company may make a sale on their website and their website code may create a customer and paymentmethod in Stripe. My app can get these, import them in to their ERP system and allow them to utilise them.

Would you mind answering the question:
I am able to use https://api.stripe.com/v1/setup_intents?customer=cus_1234&payment_method=pm_5678 to find the setupintent that created pm_5678. Will I always be able to do this or is this a bug?

analog thistleBOT
thorny crow
#

Did you try it?

fossil veldt
#

Yes, and it worked. But it is undocumented so I am not sure if I can rely on it. Hence why I am asking for confirmation.

remote hatch
#

๐Ÿ‘‹ steppin in here as pgskc needs to step away.

#

Any endpoint that you use that isn't indicated in our API Reference is not stable and could always change.

#

So that will continue to be supported

fossil veldt
#

Okay. So for paymentintents, I can search by customer and created time, but for setupintents I can search by paymetmethod.

Its a shame that paymentintents cant be searched for by paymentmethod also, as that would eliminate the guess work.

By guess work I mean take the time that the pm was created, assume that the user will have not taken more than an hour after the paymentintent was created to add the card, so search either side of an hour to find the paymentintents.

remote hatch
#

Yeah your other option is to list by Customer for PaymentIntents.

#

But you are correct that it just isn't supported to list by PaymentMethod for PaymentIntents

fossil veldt
#

And can you think of an easier way to see if a given paymentmethod has usage=off_session?