#henriquenascimento7167

1 messages · Page 1 of 1 (latest)

boreal bobcatBOT
bleak birch
#

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.');

};

mental garnet
#

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?

bleak birch
#

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

mental garnet
bleak birch
mental garnet
#

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?

bleak birch
#

Yes, I installed it correctly, but I didn't restart the server... I'll do that and test again, maybe error logs will appear.

bleak birch
#

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...😄

mental garnet
bleak birch
#

excellent my friend, thank you

mental garnet
boreal bobcatBOT