#priyan-murugan_api

1 messages ¡ Page 1 of 1 (latest)

viral thunderBOT
#

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

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

heady sentinel
full cave
#

I'm using this but I'm not getting the recent payment method

#

cus_RLkKsNR961PBjz

#

this is customer id

#

this is my code

#

PaymentMethodService pService = new();
PaymentMethodListOptions listOptions = new()
{
Customer = stripeCustomerId
};
StripeList<PaymentMethod> stripePaymentMethods = await pService.ListAsync(listOptions);
PaymentMethod paymentMethod = stripePaymentMethods.MaxBy(n => n.Created);

#

I'm getting paymentmethod null only

heady sentinel
#

That is beacuse the payment method must be verified and attached to the customer first. Since it's pending verification, it won't show.

full cave
#

ok

#

in this case, we call the setup intent then we create the payment intent based on success on setup intent

#

how can I check this user added payment method is not verified

heady sentinel
full cave
#

we have logic like, once user setup intent is done, we get the latest payment method from stripe then we charge against that payment method id

#

incase if user have one verified payment method and he wants to use diff payment method is its not verified, we not able to get the latest payment method @heady sentinel

heady sentinel
#

You can't use a payment method that has not beein verified yet so you would get an error likely if you treid to use that payment method.

#

You can retrieve the payment method by the id and look at the status

full cave
#

yes

#

thats why I want to get the recently added payment method if its not verifed I'll show the message to user, you payment method require verification like that

heady sentinel
#

So you would keep track of those payment methods, and show those messages on your page.