#joshandrews43-sources-paymentmethods

1 messages · Page 1 of 1 (latest)

wooden geode
#

Hello! Are you asking how to tell if a Source and a Payment Method both represent the same card information?

tired perch
#

Im asking how I can get a payment_method id given I only have a source id

#

im assuming it would be get source -> take fingerprint -> get payment method with that fingerprint ?

wooden geode
#

Let me clarify - Sources can be used interchangeably anywhere a Payment Method is expected. So if you already have Source objects we don't generate separate Payment Method IDs for them. You can just use the Source ID.

tired perch
#

for ach v2 (beta) i need to use payment methods everywhere, so i need a payment method id

#

if i add a card as a source, i get a different id field if i pull it as a source vs as a payment method

wooden geode
#

Can you share an example (with IDs) of a card you have that has a different Source and Payment Method ID?

modern badge
#

ah I know what you mean

#

you are talking about https://stripe.com/docs/payments/payment-methods/transitioning#compatibility , where you can retrieve legacy Card card_xxx objects on the PaymentMethod API and you get the same object, shaped as a PaymentMethod.
Note it's not two objects, it's one:

Note that with this compatibility, no new objects are created; the Payment Methods API provides a different view of the same underlying object.

#

so the core of your question is if the same works for ACHv2 , can you pass a legacy Source/BankAccount ID to the PaymentMethods API and get a view of it that way

#

which is a good question, and I don't know the answer

tired perch
#

how do you get the legacy card_xxx id?

modern badge
#

well it would be in your database

#

the point there was

  • you created hundreds of customers/saved cards over the years
  • you start using the PaymentMethods API
  • you can just use the same code for those existing customers(it doesn't matter that they use old objects, you can retrieve them from the current API) and any new ones
tired perch
#
  1. start with card_xxxxx
modern badge
#

so I assume you're asking the same but for ACH, you have saved Customers and BankAccounts and want to use the new PaymentMethod/PaymentIntents APIs for them

tired perch
#
  1. end with pm_xxxx
#

thats my question

modern badge
#

@tired perch you don't

#

but you can pass that card_xxx to the retrieve PaymentMethod API

#

and you get a PaymentMethod-shaped object

#

so to your code it's all the same

#

(the link I posted explains this)

#

so your question is ,can you pass your existing Source IDs to the new APIs that expect PaymentMethods and have it work seamlessly. It does work for cards, which is what I'm describing, you don't have to get a new ID or anything, you just pass the old IDs to the new APIs and it works

#

I'm unsure if it works for ACH, that's a good question and something @wooden geode and I can can look into

tired perch
#

that still isnt my question

#

thank you!

modern badge
#

ok what is the question then?

#

do you mean you have in your account, both, a Card card_xxx and a PaymentMethod pm_xxx, which you created independently(you asked the customer for their details twice), and are asking how to find those two objects as a pair?

#

it feels more likely to me that you are confusing how the compatibility layer for viewing Cards-as-PaymentMethods works(no new objects or IDs are created) which is why I'm explaining that, but maybe the above is what you mean, you actually create two separate objects?

wooden geode
#

@tired perch Did you get a chance to see what @modern badge asked? If you could provide some clarity on what you're really trying to ask that would be great

modern badge
#

also in case code makes this clearer, it works like this, there are no new objects involved or a requirement to get a pm_xxxx ID , you can use the card_xxx ID of a saved card everywhere you would use a 'native' PaymentMethod

let customer = await stripe.customers.create({
    email: "test@example.com",
    source:"tok_visa"
});

let cardId = customer.default_source // this is a `card_xxx` ID. 

// this works fine
let paymentMethod = await stripe.paymentMethods.retrieve(cardId);

// so does this
let pi = await stripe.paymentIntents.create({
  amount: 1000,
  currency: 'usd',
  customer:customer.id,
  payment_method:cardId, //we can pass a `card_xxx` to a field expecting a PaymentMethod
  confirm:true
});
tired perch
#

i know how the integration works, i think its just wonky. I had a card + bank (created as payment methods), then added a new source (new card number) and all my payment methods no longer show up

#

Can I give someone a customer id?

#

Actually i am just going to reach out to another contact, but thank you guys for your help

wooden geode
#

👍 If you need anything else from us just let us know

modern badge
#

would love to look at the customer ID (you can paste the cus_xxx, it's not sensitive)