#henriquenascimento7167
1 messages · Page 1 of 1 (latest)
const fetchPaymentIntentClientSecret = async () => {
const body = JSON.stringify({
amount: amount,
});
try {
const response = await axios.post(
`${API_BASE_URL}/payment/sheet`,
body,
{
headers: {
'Content-Type': 'application/json',
code: appData?.profile?.code,
Authorization: userData?.auth_token
}
}
);
const { clientSecret } = response.data;
console.log("----RESPONSE", clientSecret);
return clientSecret;
} catch (error) {
console.log("LOCAL-ERROR-AXIOS--:::", error)
}
};
const pay = async () => {
const clientSecret = await fetchPaymentIntentClientSecret();
const { error } = await confirmPlatformPayPayment(
clientSecret,
{
googlePay: {
testEnv: true,
merchantName: 'My merchant name',
merchantCountryCode: 'US',
currencyCode: 'USD',
billingAddressConfig: {
format: PlatformPay.BillingAddressFormat.Full,
isPhoneNumberRequired: true,
isRequired: true,
},
},
}
);
if (error) {
Alert.alert(error.code, error.message);
// Update UI to prompt user to retry payment (and possibly another payment method)
return;
}
Alert.alert('Success', 'The payment was confirmed successfully.');
};
Hello! That seems like some kind of version mismatch to me. What version of the React Native library are you using?
Are you using Expo by chance?
I'm using React Native 0.67 with Stripe 0.33
my project uses Node 16;
and the following buildScript data from the Gradlew build:
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
googlePlayServicesAuthVersion = "16.0.1" // <--- use this version or newer
playServicesVersion='17.0.0'
kotlin_version = '1.5.20'
ndkVersion = "21.4.7075529"
}
I was previously using Stripe React Native version 0.19, but I needed to update to be able to use PlatformPayButton, usePlatformPay
Hm, I'm not sure why you'd be getting this error. confirmPlatformPay is a function in that version of our React Native library: https://github.com/stripe/stripe-react-native/blob/c5e4fb746c13ae6fb2e718aba6756a770e1abc58/src/NativeStripeSdk.tsx#L116
ok, but do you think that these versions I'm using above could be conflicting with the version of Stripe that I installed just now?
I'm not sure, I'm not a React Native developer. Are you sure the upgrade to the newer version of the library succeeded?
And just to confirm, you're not using Expo, correct?
Yes, I installed it correctly, but I didn't restart the server... I'll do that and test again, maybe error logs will appear.
I'm using cli react native
I restarted the app and received this error when building:
What went wrong:
Execution failed for task ':stripe_stripe-react-native:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
Do you know if version 0.33 requires a specific version of kotlin?
@mental garnet Just to make sure you see my message...😄
Requirements are here: https://github.com/stripe/stripe-react-native#requirements
excellent my friend, thank you
Maybe try this to get to a more helpful error? https://stackoverflow.com/a/63517147