#felix_api
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/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.
Hi, let me help you with this.
The selected card will automatically be used for payment, you don't need to do anything yourself.
how can i fetch that payment method should in case i want to show it
Are you using a mobile SDK?
Where do you want to show it exactly?
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
Are you using customFlow=true? https://docs.stripe.com/payments/accept-a-payment?platform=react-native&ui=payment-sheet#react-native-flowcontroller
It's immediate, as soon as the customer selects the PaymentMethod.
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
now after adding the card, i want to know the card that was selected
hi! I'm taking over this thread.
yuo want to retrieve the PaymentMethod that was created? on the backend or the frontend?
on the frontend
the recommended way it to retrieve it on the backend. but it should be possible on the frontend using something like this:
let retrievedSI = await retrieveSetupIntent(clientSecret)
let pmId = retrievedSI.setupIntent?.paymentMethod
https://stripe.dev/stripe-react-native/api-reference/index.html#retrieveSetupIntent
i don;t why the docs is not opening on my end
what if i want to do it on the backend
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 thesetup_intent.succeededwebhook event to be notified when the SetupIntent suceeeded, and from there retrieve the associated payment method.
so the payment method doesn't get attached immediately
this link https://stripe.dev/stripe-react-native/api-reference/index.html#retrieveSetupIntent is not going on my end
i can't access the website
Documentation for @stripe/stripe-react-native
using the webhook, does it mean the payment method is not added the the intent immediately/
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.
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
if you are using a SetupIntent with a customer set, then the payment method is automatically attached to the customer when the SetupIntent suceed.
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?
- you create the SetupIntent
- the user enter their information and submit the form
- now the SetupIntent has
status: succeededand contains a PaymentMethod.