#dan_api

1 messages ¡ Page 1 of 1 (latest)

mental yachtBOT
#

👋 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/1290166037651918849

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

low silo
#

There's no default_payment_method for customer. Are you referring to the customer's invoice_settings_default_payment_method ?

winter hatch
#

Hey Jack, on the dashboard where it's marked default - is that something different?

#

In the above example, I want to return the Visa as the payment method to use for a payment intent. But the first result is always Link

low silo
#

What's the customer ID>?

winter hatch
#

Thank you, that makes a lot of sense! To make it a bit more.. confusing, the payment system currently utilises a mix of Source and Payment Methods (legacy things..)

Would the default source on a customer always be the last payment method (regardless of it being a payment method or via source)?

#

Customer ID: cus_QvObzUkm5xIi07

low silo
#

Thanks for the ID, the 4242 card is the customer's default_source

winter hatch
#

Can that default source also be a link/payment method (non-source api based) as well?

low silo
#

No, only source objects (i.e., card sources)

winter hatch
#

Would it be correct to say if default_source is set to null, and default_payment_method is set to null. There is no default payment method set for the customer?

#

And if so, would my process of obtaining the last card be:

  1. Check customer object
    -- If default_source is not null, use this as payment intent source
    -- If default_payment_method is not null, use this as payment intent source
  2. If neither have returned, call the payment methods API against a customer to return all their cards/link. Order the results by created and use that as payment method for a payment intent source
low silo
winter hatch
#

The problem I encountered with this API call is it was always returning Link as the first Payment Method when a Source Card was the last method added

low silo
#

Hmm, I see. You can also check the PaymentMethod's created timestamp

winter hatch
#

To confirm, the easiest way is calling the API, getting all payment methods and sorting by timestamp?

low silo
#

Yes you are right