#mohit_39749
1 messages · Page 1 of 1 (latest)
Can you share your code and the exact line that threw this error?
Here is the Frontend Code
const handlePayPress = async () => {
try {
const response = await fetch('http://10.255.254.170:5000/create-payment-intent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount: parseInt(amount) }),
});
const { clientSecret, error } = await response.json();
if (error) {
console.log('Error:', error);
Alert.alert('Error processing payment');
} else {
const { paymentIntent, error } = await confirmPayment(clientSecret, {
type: 'Card',
paymentMethodType: ['card'],
billingDetails: { email },
});
if (error) {
console.log('Payment Confirmation Error:', error.message);
Alert.alert(`Payment Confirmation Error: ${error.message}`);
} else if (paymentIntent) {
console.log('Payment successful:', paymentIntent);
Alert.alert('Payment Successful');
}
}
} catch (e) {
console.error(e);
Alert.alert('Error processing payment');
}
};
Let me know whats the problem
Which line is throwing the error?
Error is "Value for payment method type cannot be cast from ReadableNativeArray to String"
Payment method type
Which exect line of the code that this error was returned? We need to know the exact line that threw this error in order to know what the problem is
Here is the Frontend Code
const handlePayPress = async () => {
try {
const response = await fetch('http://10.255.254.170:5000/create-payment-intent', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ amount: parseInt(amount) }),
});
const { clientSecret, error } = await response.json();
if (error) {
console.log('Error:', error);
Alert.alert('Error processing payment');
} else {
const { paymentIntent, error } = await confirmPayment(clientSecret, {
type: 'Card',
paymentMethodType: ['card'],
billingDetails: { email },
});
if (error) {
console.log('Payment Confirmation Error:', error.message);
Alert.alert(`Payment Confirmation Error: ${error.message}`);
} else if (paymentIntent) {
console.log('Payment successful:', paymentIntent);
Alert.alert('Payment Successful');
}
}
} catch (e) {
console.error(e);
Alert.alert('Error processing payment');
}
};
const { paymentIntent, error } = await confirmPayment(clientSecret, {
type: 'Card',
paymentMethodType: ['card'],
billingDetails: { email },
});
on This code
??
Which mobile SDK and version do you use?
I am using Expo React Native
Android And Ios
Android API 34 google API
Please let me know the Solution
??