#felix_api

1 messages ¡ Page 1 of 1 (latest)

steep quiverBOT
#

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

📝 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.

plucky dew
#

Hi, let me help you with this.

#

The selected card will automatically be used for payment, you don't need to do anything yourself.

subtle wind
#

how can i fetch that payment method should in case i want to show it

plucky dew
#

Are you using a mobile SDK?

subtle wind
#

yes

#

react native

plucky dew
#

Where do you want to show it exactly?

subtle wind
#

so after this intent screen, i have another screen where i want to show the particulare card that was selected on that screen

#

also, how long does it take a payment method to be attached to an intent

plucky dew
subtle wind
#

i am actually setting up an intent with setupInent, so that i can attach a card to a payment

#

not to a payment, to a customer

#

i will share snippet

#

const setupIntent = await stripe.setupIntents.create({
customer: customerId,
automatic_payment_methods: {
enabled: true,
},
});
const data = {
setupIntent: setupIntent.client_secret,
ephemeralKey: ephemeralKey.secret,
customer: customerId,
}

#

with this code, i am generating an ephmeral key for the frontend to render the stripe UI

steep quiverBOT
subtle wind
#

now after adding the card, i want to know the card that was selected

mighty parcel
#

hi! I'm taking over this thread.

#

yuo want to retrieve the PaymentMethod that was created? on the backend or the frontend?

subtle wind
#

on the frontend

mighty parcel
subtle wind
#

i don;t why the docs is not opening on my end

#

what if i want to do it on the backend

mighty parcel
#

i don;t why the docs is not opening on my end
what do you mean?

#

what if i want to do it on the backend
you could listen to the setup_intent.succeeded webhook event to be notified when the SetupIntent suceeeded, and from there retrieve the associated payment method.

subtle wind
#

so the payment method doesn't get attached immediately

#

using the webhook, does it mean the payment method is not added the the intent immediately/

mighty parcel
#

maybe try a different browser? anyway you don't really need the link since I shared the code you can use.

#

using the webhook, does it mean the payment method is not added the the intent immediately/
I don't understand the question. using a webhook doesn't change anything to the payment flow, it just notify you when something happens.

subtle wind
#

yes i know, i am asking if attaching the payment method to an intent takes some time or it is immediate

why i am asking is, immediately i attach a payment method to an intent, if i retreive the intent immediately, i don't see the payment method in the object, it returns null

mighty parcel
#

if you are using a SetupIntent with a customer set, then the payment method is automatically attached to the customer when the SetupIntent suceed.

subtle wind
#

hmmmm

#

i think i am getting it now

#

so then it is the set up intent that takes time to get to a success state yeah?

mighty parcel
#
  1. you create the SetupIntent
  2. the user enter their information and submit the form
  3. now the SetupIntent has status: succeeded and contains a PaymentMethod.