#nickderobertis

1 messages · Page 1 of 1 (latest)

green mesaBOT
mental root
#

Hello! What do you mean by "belongs to"? Like one that's been attached to a Customer?

stiff lintel
#

Hi, yes sorry attached

mental root
stiff lintel
#

oh great, this works even better for our purpose. because in our case we lost some customer IDs and now are not able to create payment intents for those payment methods. but with this we can even just recover that customer ID. thanks!

#

This payment method api works for Card objects too, right?

#

Or do we need to inspect the ID and switch to calling retrieve card?

mental root
#

But the principal is the same.

stiff lintel
#

ok cool, we'll do some switching logic on the first part of the ID then.

#

Last thing to confirm, so this note on retrieve payment method is more a best practice than a restriction? The API will still work when the payment method is attached to a customer?

To retrieve a payment method attached to a Customer, you should use Retrieve a Customer’s PaymentMethods

mental root
#

If you have the Payment Method's ID it will work, yeah.

#

At least I'm pretty sure it will... not sure why it wouldn't.

stiff lintel
#

Ok awesome. Thanks for your help!

#

It seems like all the card endpoints are prefixed by customer ID. So is this not possible for Card objects? Is there another strategy I can use?

#

I guess my original thought of validating would still be possible. If we plug a customer ID and card ID in, it would assumedly return a not found response if the card is not attached to the customer. But there's no way to recover the customer ID given a card ID?

mental root
#

So you have a bunch of Payment Method and Card IDs and you need to find the associated Customer IDs?

#

Oh, wait, that requires a Customer ID too.

#

Hm.

#

There may not be a way, actually. At least not via the API.

#

You can look in the Dashboard... how many do you have?

stiff lintel
#

160K haha

#

gotta be by API

mental root
stiff lintel
#

Yeah that seems like it could work! A little roundabout but I'm glad this is possible

mental root
#

Yeah, I can't find a more direct way to do it.

stiff lintel
#

So customer.sources[].data.id will return Card id? Or do I need to back into the card from a Source object somehow?

mental root
#

It depends on how the Card was attached. Did you use Cards directly or did you wrap them in Sources? Or a mix? You might need to do both depending on what you find in the result.

stiff lintel
#

I think cards directly, but not 100% clear on that, will need to review the existing implementation

#

What does the response look like for standalone Card versus Source-wrapped Card?

dense osprey
#

👋 hopping in here since rubeus has to head out

#

The Card and Source objects are slightly different. If you're attaching Sources instead of Cards then you'll have to check the card hash for the card-specific details

stiff lintel
#

👋 Hey! Thanks for jumping in.

dense osprey
#

Yeah I'm not sure why it's not reflected in the API reference, but here's a quick example that I did on my end

stiff lintel
#

That's super helpful, thanks! Hmm but I notice the Card wrapped in the source doesn't have a Card ID in the card part. Is there not a Card ID when a Card is wrapped in a Source?

dense osprey
#

Yeah I don't think you get that back with the Source object if it's wrapping a card

stiff lintel
#

Are you saying in general or just with this response? Like if we were historically wrapping cards with sources, would we have only ever seen Source IDs and not Card ids? Or if it's just this response, what endpoint should I use to go from Source ID -> Card ID?

dense osprey
#

Let me back up - if you've been only creating Sources/cards wrapped in Sources then you'll have only been working with Source IDs.

#

There isn't an endpoint to go from the Source -> Card

stiff lintel
#

Ok thank you, that definitely clarifies things. Examining our database, we only have card_xxx and pm_xxx ids, not src_xxx ids, so it seems that we have not wrapped cards in sources. In that case, I should get the object: card example response you gave.

dense osprey
#

yup!