#pablo-c_legacy-sources-redisplay
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/1412913434416124027
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
I dont have to have to bother all my existing customer and have them recreate their payment methods using the new payment methods api
So to reduce friction while still being able to upgrade to the new payments api, what I need is to find a a way to:
Take an existing legacy Source ID (card_xxx or src_xxx)
Convert it to a Payment Method (pm_xxx)
Maintain the ability to charge the card for future payments
Ideally, do this entirely server-side without customer involvement
note that we have over 12.000 saved cards (hard to tell how many of those have not expired by now, as weve been working with stripe for over 6 years), but a big chunk of those cards are active in our system, meaning we still use them to charge those customer whenever they want to buy something from us. This is done with zero friction thanks to the old legacy card/chargeds api
You can use Payment Method Creation API: https://docs.stripe.com/api/payment_methods/create?api-version=2025-06-30.basil#create_payment_method-card and set card source on card.token
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
are you referring to this bit: "you can alternatively provide a Stripe token (e.g., for Apple Pay, Amex Express Checkout, or legacy Checkout) into the card hash with format card: {token: "tok_visa"}"
If so, that wouldnt work as card tokens are single use. Because my legacy cards have already been created into stripe's system using their corresponding tokens, I have no way of getting another card token to use it in a "create payment method" api call.
for example, in the following image from my stripe's sandbox account, you can see I have a card that was created using the old legacy system of tokens. I need to be able to create a new payment method, for this sam stripe custmer, using only the info from the old saved card source (meaning I dont have access to a new card token, only to its stripe card id or source id, in this case its card_1QPUOQBqyj6dLLomhj8LVpv6)
Card token is compatible with Payment Method. You can use it like how Payment Method is used. Are you facing any issue using card source (card_123) directly on Payment Intent or other integration?
Card source is not deprecated. Only the non-card sources are
I think you are not understanding my question. I have a saved card source, in this case from the screenshot, the one with ID: "card_1QPUOQBqyj6dLLomhj8LVpv6". I can charge that card without issues using the old charges API. The thing is, I want to start migrating into using the new payment methods api (together with stripe checkout).
I already implemented stripe checkout and everything works fine, but I noticed my old customers are not getting their credit card prefilled into the hosted checkout form (even though im passing the stripe_custmer_id param when creating the checkout session). I investigated why this happens and found out that old cards saved from the legacy system are will not be populated into the stripe checkout page. I found out I needed to recreate those legacy sources as payment methods using the new api. I did a test creating the payment method manually from the stipe dashboard and was able to corroborate that the new card details did get prefilled into the stripe checkout session as expected.
So the issue im facing now is finding a way to programmatically create a new payment method for each of the old card sources I have in the stripe system. And the issue with this, is that the api call to create a new payment method requires either a card token (which I dont have) or the full card details (which I dont have either). All I have is the info that i can programmatically pull from stripe for my old saved card sources .
im not sure if my issue is more clear now?
Thanks for sharing. This is very clear now.
So, what you're trying to achieve is:
- Convert card source to payment method
- Have the converted payment method to be prefilled in the Checkout Session
Is my understanding right?
Hello ๐
I'm stepping in as my colleague had to go. I am sorry to report that what you are attempting is not possible. While card_ objects are still compatible with the Payment Method API, they do not implement all the necessary features for redisplay. Specifically, you must have a valid billing_details.address associated with a Payment Method to enable the display in Checkout.
However, you cannot use the Update API to set this on a legacy card_ object. I just tested this myself and I got the following error
error: {
message: "This PaymentMethod was converted from a legacy Card object. You may not update the email or phone number of these PaymentMethods.",
request_log_url: "https://dashboard.stripe.com/test/logs/req_FWynh3cQ7piyGH?t=1756939079",
type: "invalid_request_error",
},
As for converting card_ objects into Payment Methods, I'm afraid we do not have an API method for that.