#tarantino-47_best-practices

1 messages ยท Page 1 of 1 (latest)

crimson sunBOT
#

๐Ÿ‘‹ 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/1222489398398947439

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

hexed coyoteBOT
#

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.

hushed drum
#

๐Ÿ‘‹ happy to help

severe raven
#

ok, I have a question then

hushed drum
#

yes sure

severe raven
#

I may already asked similar question before, sorry about that

the thing is I need to retrieve billing address from apple pay or google pay card. I decided to create payment method using react native stripe sdk and then I get the address and use it in my checkout flow. Also before using the created payment method - I attach it to the stripe's account. And then pay.

The thing is I already have integrated apple pay using PaymentIntent. I don't like the integration as we have to use stripe webhooks in order to see if the payment went through. I want to refactor integration and use the approach above(create PM on the react native client). I'd like to know should I refactor or no, is this approach solid or no? is it better that using paymentintent or setupintent or no?

please let me know your thoughts

hushed drum
#

it's not the right approach

#

why not save the PM during payment?

severe raven
#

it's not the right approach
which one?

hushed drum
#

to create PM then attach it then paying

severe raven
#

I need to know the address attached to the apple pay card in order to reduce steps of my chekout form

hushed drum
#

you can with this approach

severe raven
#

but you can use this instead
I want to keep my custom form and only have apple or google button

hushed drum
#

that's not available in react native

severe raven
#

ok, let me think

#

it's not the right approach
what's your concerns regarding using this?

hushed drum
#

how are you going to collect the PM?

severe raven
#

import {
createPlatformPayPaymentMethod,
} from '@stripe/stripe-react-native';

createPlatformPayPaymentMethod(params)

hexed coyoteBOT
fierce fiber
#

that would work fine yes I think. But is there a reason you want to use PlatformPay directly rather than the overall PaymentSheet(which supports Apple Pay)?

severe raven
#

yes, I want to keep my custom form and only have apple or google button
also I need to retrieve the address attached to the apple pay card in order to reduce steps of my chekout form

fierce fiber
severe raven
#

I agree, that's why I removed billing address form completely for apple pay. at the very end of my form, user clicks apple pay button -> I create PM -> attach it to the customer, retrieve billing address -> pass PM, billing address and other form info to the BE

#

let me know your thoughts

#

so basically after apple pay modal closes - I almost immediately set loading state and make a request to my BE

fierce fiber
severe raven
#

That will just happen automatically if you confirm a PaymentIntent
you mean confirm on the back end, right?

#

cuz creating PM opens apple pay bottom modal and confirming payment intent also opens that modal

fierce fiber
#

no, it happens if you confirm on frontend too.

#

if you create the PaymentIntent with a customer and setup_future_usage (creating the PaymentIntent is always done on the backend), and you confirm the PaymentIntent (anywhere), the PaymentMethod used for the payment gets attached to the customer.

#

creating PM opens apple pay bottom modal and confirming payment intent also opens that modal
I mean it shouldn't, unless you're doing something unusual. Hard to say without seeing all your code.

severe raven
#

sometimes I have to use setup intent too

#

pls don't close this thread for now
I need to check one thing

severe raven
#

after I confirmed a PaymentIntent i get this oject as a result:

id: "pi_blahblah"
status: "Succeeded"
description: "blahblah"
shipping: null
amount: 634
receiptEmail: null
livemode: false
clientSecret: "pi_blahblah"
captureMethod: "Automatic"
canceledAt: null
paymentMethodId: "pm_blahblah"
paymentMethod: null
created: "1711538446000"

can I somehow retrieve a billing address attached to the user's apple pay card knowing paymentMethodId?

fierce fiber
severe raven
#

would it work for setup intent too?

fierce fiber
#

yes

severe raven
#

ok, thank you, for how long will you be available today? can we not close this thread?

fierce fiber
#

it will be closed after ~15 minutes of inaction

severe raven
#

would it work for setup intent too?
I heard somewhere that if there is no charge we can't retrieve billing address

fierce fiber
#

not sure where you heard that

#

it's easy to test anyway and confirm for yourself

severe raven
#

true, I'm gonna test it right now using setup intent

#

hope this thread won't close automatically

fierce fiber
#

if it does and you're stuck with something you'd just ask your specific question in a new thread via #help

severe raven
#

ok, looks like it works for setup intent as well

#

one last question lol
so using PlatformPay directly is also a way to go, but you/stripe recommend using PaymentSheet and payment/setup intent?

fierce fiber
#

they both work. The advantage of using PaymentSheet is you get multiple payment methods supported, including just a normal 'type your card in' form. If you use PlatformPay and the customer doesn't have a wallet set up on their phone, and you haven't build another UI or payment method, they can't pay.