#tarantino-47_best-practices
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/1222489398398947439
๐ 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.
- tarantino-47_api, 1 hour ago, 17 messages
- tarantino-47_api, 13 hours ago, 21 messages
๐ happy to help
you can look at the react native iOS guide https://docs.stripe.com/apple-pay?platform=react-native
a better guide would be https://docs.stripe.com/payments/accept-a-payment?platform=react-native that covers how to integrate PaymentSheet that offers both Apple Pay and Google Pay
ok, I have a question then
yes sure
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
it's not the right approach
which one?
to create PM then attach it then paying
but you can use this instead https://docs.stripe.com/payments/accept-a-payment-deferred
I need to know the address attached to the apple pay card in order to reduce steps of my chekout form
you can with this approach
but you can use this instead
I want to keep my custom form and only have apple or google button
that's not available in react native
ok, let me think
it's not the right approach
what's your concerns regarding using this?
how are you going to collect the PM?
import {
createPlatformPayPaymentMethod,
} from '@stripe/stripe-react-native';
createPlatformPayPaymentMethod(params)
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)?
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
I don't really get what "I need to know the address attached to the apple pay card in order to reduce steps of my chekout form" means though. The right flow is always that the customer uses the Apple Pay button to actually checkout, it would be a bit weird to pop up the Apple Pay dialog and then have separate steps after that to actually make the payment https://developer.apple.com/design/human-interface-guidelines/apple-pay/#Streamlining-checkout
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
my main thought is why do you need to manually attach it to the customer? That will just happen automatically if you confirm a PaymentIntent that already has customer set on it and setup_future_usage. (https://docs.stripe.com/payments/save-during-payment?platform=react-native&mobile-ui=payment-element#react-native-add-server-endpoint)
But sure, it works either way.
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
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.
sometimes I have to use setup intent too
pls don't close this thread for now
I need to check one thing
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?
on the backend you'd call https://docs.stripe.com/api/payment_methods/retrieve and look at billing_details https://docs.stripe.com/api/payment_methods/object#payment_method_object-billing_details
would it work for setup intent too?
yes
ok, thank you, for how long will you be available today? can we not close this thread?
it will be closed after ~15 minutes of inaction
would it work for setup intent too?
I heard somewhere that if there is no charge we can't retrieve billing address
true, I'm gonna test it right now using setup intent
hope this thread won't close automatically
if it does and you're stuck with something you'd just ask your specific question in a new thread via #help
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?
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.