#spharian_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/1319768557638385675
๐ 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.
- spharian_return-url-reactnative, 20 hours ago, 50 messages
Hello, to make sure I am clear on your question: are you trying to save a user's apple pay card to Stripe? Or save a card to their Apple Pay wallet via Stripes APIs? Only the first one is possible at the moment, but I am happy to help you get through any steps that you are stuck on for that process
Hello, I'm trying to do like the second screenshot. On an app I use, they make a payment of 0.00โฌ with Apple Pay and save infos for later
Ah gotcha, in that case any of our flows for setting up future payments should work for you. Basically you will want to create a SetupIntent and then confirm it. These docs walk through that process across a variaty of surfaces
https://docs.stripe.com/payments/save-and-reuse
https://docs.stripe.com/payments/accept-a-payment-deferred?platform=web&type=setup
That's what I've done but the result is the first screenshot
Have to enter card infos manually
Do you have apple pay cards saved on that device that you can use otherwise?
Like does Apple Pay show up for you on this webpage and if you click the "Pay" button with it selected does it let you choose a card? https://4242.io/test/payment-element/
yes when I press pay here it's what i want on my app
I want this view + save payment method for later
when confirming a payment of 0.00โฌ
but for now I use this code and it only shows empty card sheet. I guess i have to change it to a 0โฌ payment but idk how to save the payment method for later if so
Have you done the steps from this part of the doc? https://docs.stripe.com/payments/accept-a-payment?platform=ios#ios-apple-pay
If Apple Pay isn't showing up in the payment sheet, that may be why
Oh wait you are using RN, here is the doc section for that https://docs.stripe.com/payments/accept-a-payment?platform=react-native#react-native-apple-pay
yes i have created merchant identifier, and as I am using Expo, I followed the documentation here: https://docs.expo.dev/versions/latest/sdk/stripe/#config-plugin-setup-optional
$setupIntent = $user->stripe()->setupIntents->create([
'customer' => $user->stripe_id,
'payment_method_types' => ['card'],
'metadata' => [
'user_id' => auth()->user()->id,
'payment_method' => UserPaymentMethod::ApplePay->value,
],
]);
maybe something is wrong in my back end and I should set apple pay somewhere here : 'payment_method_types' => ['card'],
(for my payment intent)
My apologies for dropping off of this thread. Checking in to why this may still not be showing up for you
I will ask my colleagues who know a bit more about our RN SDK
Can you send me the text of the code from that snippet? Makes it easier to share internally
Also, taking a step back if you are looking to have a button that just launces the apple pay sheet, you will want to use the platform pay button. The payment sheet that you are currently using is our product that is mean tot present multiple different payment methods in one place. So it will always at least show card and Apple Pay once you have Apple Pay properly set up here https://docs.stripe.com/apple-pay?platform=react-native#present-payment-sheet
here is the code
Thank you! And one last thing, can you send me the ID of a setup intent that you created for one of these tests? (seti_)
Checking an account ID that you posted here before (acct_16CvvlKZwi6wapvm) I actually don't see any iOS Certificates set up on that account as specified in thefrom the RN doc that I linked. So you may have to do those again if this is the account that you are testing on
https://docs.stripe.com/payments/accept-a-payment?platform=react-native#react-native-apple-pay
hmm yeah didn't upload it for my test account, but it says Apply pay is available when i check with the code
Which line(s) of code is that?
I am pretty sure you need that full process to happen for apple pay to work with Stripe. Even if your app would be able to accept payments with the apple pay SDK directly otherwise
const [isApplePaySupported, setIsApplePaySupported] = useState(false);
useEffect(() => {
(async function () {
setIsApplePaySupported(await isPlatformPaySupported());
})();
}, [isPlatformPaySupported]);
it shows true. But i will upload the certificate in test mode as well
Ah it looks like that method may just check if the device itself supports Apple Pay, rather than the whole certificate setup thing. That can probably be made clearer in some doc
https://github.com/stripe/stripe-react-native/blob/a733a85cd68e22f3030b313609a0d9e20426f9ff/ios/StripeSdk.swift#L390-L395
I uploaded in test mode the same cert as prod, as I could create only 1 for the merchant id
hope it's ok
oh
When I comment payment card "Card", it also shows PayPal but not Apple Pay
Apple Pay should be under card. Also I just noticed the small section under the one that I linked.
https://docs.stripe.com/payments/accept-a-payment?platform=react-native#add-apple-pay
It mentions adding your merchant identifier to your StripeProvider if you have not already and adding apple pay settings to your paymentinitPaymentSheet which I do see is missing in the code sent above:
await initPaymentSheet({
// ...
applePay: {
merchantCountryCode: 'US',
},
});
oooh
It appeared with the merchantCountryCode
thanks a lot! How important is the country code? Our company is registered in Luxembourg, guess I should use LU?
I am pretty sure you just need to set it to whatever your account's country is but let me double check
I can confirm it should be your country code, so LU makes sense here. Unfortunately I haven't found anything else on the "why" of this requirement
Ok thanks
Last question, I am almost done, do you know if I can just show Apple Pay here?
I think it's a configuration in SetupIntent
I will double check but unfortunately I don't think there is. I think you may want to try switching to the platform pay button, that will let you directly open the apple pay UI with their saved cards and it doesn't include the card input UI from the payment sheet.
https://docs.stripe.com/apple-pay?platform=react-native#present-payment-sheet
Ok I see. Do you think I could just use the pay method, and use my own component button?
Unfortunately no way to prevent that card input from showing up while using the stripe PaymentSheet. The platform pay button directly invoke's Apple's payment sheet
And I think you can use your own button but it needs to conform to apple's guidelines https://developer.apple.com/design/human-interface-guidelines
Our platformPayButton is basically a pre-built UI button that conforms to those standards
Ok thanks for your help ๐