#carelessrabbit
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- rabbit-reactnativeexpo-applepay, 6 hours ago, 72 messages
Hi there, can you tell me what problem that you are trying to resolve?
HI there could you check this thread?
It's a long thread, it'll be easier and faster for me to start the troubleshooting if you can tell me what goal you want to achieve here.
Could you read then just my first post?
I am trying integrate Apple Pay via Stripe with react native via expo but I am stuck with one error. I am out of options on what it could be. Can anyone suggest directions on debugging, or maybe know the answer?
I followed guide from https://stripe.com/docs/apple-pay?platform=react-native#handle-payment
I have done very exact same solution: https://codefile.io/f/1qbW7wMwLa
However, when I click pay using confirmPlatformPayPayment or confirmPlatformPaySetupIntent, I get exact same error:
error: {"stripeErrorCode":null,"declineCode":null,"localizedMessage":"The payment has been canceled","message":"The payment has been canceled","type":null,"code":"Canceled"}
Addtional info:
On server side, my payment intent looks like this:
const paymentIntentOptions: Stripe.PaymentIntentCreateParams = {
amount: fullAmount,
currency: currency,
customer: stripeId,
application_fee_amount: fee,
transfer_data: {
destination,
},
metadata: {
checkInId,
checkOutTime,
},
};
I don't see any logs from Stripe Dashboard, upon clicking pay it does not log on stripe end.
Versions:
"expo": "^48.0.0"
"@stripe/stripe-react-native": "0.23.3"
Stripe default API: 2019-05-16
Tested device using expo-dev-client: iphone 13 pro max
Tested ios version: 16.6.1
"expo-dev-client": "~2.2.1"
any ideas?
what's the payment intent ID?
I think this one: pi_3O9EdwKwGkja34pa1vCgcrFY
It's payment in test environment.
Could you go briefly through thread cause your asking same questions
Through a bit additional look, I found that I am getting first error saying:
{"stripeErrorCode":null,"declineCode":null,"localizedMessage":"Payment not completed","message":"Payment not completed","type":null,"code":"Failed"}
Then afterwards I am getting:
{"stripeErrorCode":null,"declineCode":null,"localizedMessage":"The payment has been canceled","message":"The payment has been canceled","type":null,"code":"Canceled"}
Is this the correct paymentIntent ID? I don't see any request from your react native app to confirm this payment intent.
https://dashboard.stripe.com/test/logs/req_yJJa21noN6l2HU and I saw this request from your react native app, and the payment confirmation succeeded.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
it's in test env
Are you using expo go?
I don't see any confirmation request for pi_3O9EdwKwGkja34pa1vCgcrFY either.
https://stripe.com/docs/apple-pay?platform=react-native#accept did you complet these steps to enable google pay in your react-native iOS app?
yes I have
what does isPlatformPaySupported return? https://stripe.dev/stripe-react-native/api-reference/index.html#isPlatformPaySupported
Documentation for @stripe/stripe-react-native
true
const CheckoutPaymentPlatform: FC<any> =
useEffect(() => {
(async function () {
setPlatformPaySupport(await isPlatformPaySupported());
})();
}, [isPlatformPaySupported]);
useEffect(() => {
(async function () {
const clientSecret = await fetch();
setClientSecret(clientSecret);
})();
}, []);
const pay = async () => {
const { error } = await confirmPlatformPayPayment(
clientSecret,
{
googlePay: {
merchantCountryCode: 'GB',
testEnv: true,
currencyCode: 'GBP',
},
applePay: {
cartItems: [
{
label: 'parking',
amount: billAmount,
paymentType: PlatformPay.PaymentType.Immediate,
},
],
merchantCountryCode: 'GB',
currencyCode: 'GBP',
},
}
);
if (error) {
// handle error
console.error("error: ", JSON.stringify(error))
} else {
Alert.alert('Success', 'Check the logs for payment intent details.');
}
};
return (
<View
style={Styles.wrap}
>
<View style={Styles.buttonContainer}>
{platformPaySupport && <PlatformPayButton
onPress={pay}
type={PlatformPay.ButtonType.Checkout}
appearance={PlatformPay.ButtonStyle.Black}
borderRadius={4}
style={{
width: '100%',
height: 50,
}}
/>}
</View>
</View>
)
}```
https://stripe.dev/stripe-react-native/api-reference/interfaces/InitStripeParams.html did you specify the merchantIdentifier when you initialize the SDK?
yes, I did
<StripeProvider publishableKey={STRIPE_PUBLIC_KEY} merchantIdentifier={MERCHANT_ID}> </StripeProvider>
that how I do it
Ok, did you see the Apple Pay payment sheet popping up after calling confirmPlatformPayment ?
And do you have a valid card added to your Apple Pay wallet?
Ok, do you have the same problem with Google Pay?
I noticed that you are using cartItems in confirmPlatformPayPayment, but this params is only added in react-native sdk 0.24.0, and you are using 0.23.3
are you sure?
but why do I see when I go into the function?
how confirmPlatformPayPayment looked on 23.3?
I can't update higher since expo 48 can only support 23.3, and for higher one it requires migration.
I would appreaciate if you could me understand how confirmPlatformPayPayment should look like?
Sorry I was wrong, it's called cartItems for ApplePayBaseParams , even in 0.23.3 https://github.com/stripe/stripe-react-native/blob/v0.23.3/src/types/PlatformPay.ts#L57C29-L57C29
What' the valude of billAmount ?
it would string would like 101, and then converted to number, and then divided by 100 and then converted to string again.
from "101" you would get "1.01"
Do you see any errors from the xcode log? npx react-native log-ios
It would work on development build.
Is your test device connected to your Mac?
no it's not should it be?
yes you need to connect your test device in order to get logs
i sent dev client to my device and fetching the javascript throught LAN connection
does it have to special connection and setting?
I am still getting same error?
Could old stripe API version be an issue?
I don't think so.
I'd suggest you to get the native debugging working and see if the xcode logs could give you anything useful.
I have migrated expo version from 48 to 49
Which allowed me to update from 23.3 to 28 stripe
However, my app closes after I attempt to pay, for payment intent in test env. Why?
I see wallet, I can click and verify with face ID my card. I see it's attempting to use my real card. I confirm as usual but app gets closed.