#elBR
1 messages · Page 1 of 1 (latest)
Hi there!
PaymentMethods object (pm_xxx) is the newest and recommended way to handle payment methods. Cards (card_xxx) also works, but it's older.
You can use both pm_xxx and card_xxx to accept payments.
the problem is that I see different types of cards created during the flow
when I create a payment method directyle it gets created as card_xxx
when the card is created along with a subscription create is gets created as pm_xxx
when I pay an one-off invoice it gets created as source_xxx
the problem is that I cannot get the default payment method
when I check for default source and the card is pm_xxx I get an error saying that the source does not exist
If I use default payment method and the default is a source_xxx I get no default as a result
is really a mess
can you please give me a solution on how can I determine the default card?
Thanks for the additional information. There are two places to check on the customer object:
invoice_settings.default_payment_method, that could either contain apm_xxxor acard_xxxsource, that could contain asrc_xxx
I should call all the two APIs?
what approach does Stripe use on dashboard for fetching the default payment method?
does they call two API on themselves?
Are you asking this to know which default payment method will be used for a subscription or an invoice?
It looks like for subscription we first check the default payment method set on the subscription itself, then look at the source of the customer, and then at the invoice_settings.default_payment_method of the customer
You can learn more about this here: https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method
no I am not asking that
I am asking how can I check user's default payment method
what API endpoint should I call?
to get the default payment method, ignoring the fact that i can have card_xxx, pm_xxx, source_xxx
You need to check two things: the source of the customer and the invoice_settings.default_payment_method. You can get both with one API call.
no, this is the problem
If I use that and user has the default card with source_xxx, I will get nothing as user's default card
invoice_settings.default_payment_method will ignore payment methods that has the id source_xxx or card_xxx
I'm sorry I don't understand the issue.
- If a customer has a source_xxx, then just check
customer.sourceto find it. - And if the customer doesn't have a source, check
invoice_settings.default_payment_methodto find apm_xxxorcard_xxx.
Note that it's also possible for customers to have no default payment method set.
but since default payement method is unique between all type of cards, why should I check invoice_settings.default_payment_method as well as customer.source
isn't there any api endpint that would give me the default one
I am curious to know, what API call does Stripe use on dashboard to show the default payment method?
why should I check invoice_settings.default_payment_method as well as customer.source
I agree this is not ideal. but if your integration is using both pm_xxx and source_xxx, then you need to check both places.
Don't know exactly how the dashboard works, but they probably do the same thing: check both source and invoice_settings.default_payment_method. Both can be done in one API call.
ok
I have another question on general
what approach should I use to create a payment method
I have a backend and a frontend
Currently I create a setupintent on by backend and then I confirm that on frontend
should I create it directly on froneted using createPaymentMethod?
this one?
is the flow that I follow is better?
Currently I create a setupintent on by backend and then I confirm that on frontend
This is the recommended flow.
And we have some docs about this if needed: https://stripe.com/docs/payments/save-and-reuse?platform=web
is it true that if I create a subscription and I pay the invoice on Stripe, the card gets created as src_xxx?
👋 taking over for my colleague. Let me catch up.
please let me know
Stripe used 2 kinds of defaults, just checked
it used default_source and default_payment method
so custoer can have two default cards on the same time
quick question how are you settling the invoice? are you using Charge automatically or Send Invoice?
I am paying the invoice manually on Stripe
how exactly? on the dashboard or on the Hosted Invoice Page?
so you're using the Hosted Invoice Page
that's why you're seeing the src_xxx objects
since this product still uses Sources for the most part and card_xxx for the any invoice paid with a card
Buy why Stripe is using so many card types that are confusing
now I have a strange problem
I have these 4 payement methods
as long as I use Stripe Dashboard to make a payment method as default, then after I fetch payment methods on my application I get all payment methods with invoice_settings.default_payment_method: null
instead if I run the api call from my application and update invoice_settings.default_payment_method then everything works fine
why if I choose the default card on Stripe Dashboard makes invoice_settings.default_payment_method: null for all payment methods
this is weird
customer_id: cus_MhHyeFwtBvmEOC
this is the customer I am using
first let's get a couple of things clear here, Hosted Invoice Page isn't the Stripe Dashboard (just to avoid the confusion)
and the "Default" you see here isn't the invoice_settings.default_payment_method but instead the default_source on the customer object
does that answer your Q?
fyi
this card was created through the dashboard hence the card_xxx https://dashboard.stripe.com/test/logs/req_cjTEMyXjpoelHZ
whereas this card was created through the Hosted Invoice Page hence the src_xxx
https://dashboard.stripe.com/test/logs/req_aOTEO6KTScL8vi
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.