#jesuisilya
1 messages · Page 1 of 1 (latest)
hi! what's the exact code you're using?
Overall I'm not sure the RN library supports calling that function with a pm_xxx ID directly, but can have a look
const createPaymentMethod = async () => {
const { error, paymentMethod } = await createGooglePayPaymentMethod({
amount: 0,
currencyCode: 'GBP',
});
if (error) {
Log.error('Error when creating Google Pay method', error.code, error.message);
} else if (paymentMethod) {
Log.debug('Payment Method created successfuly', JSON.stringify(paymentMethod));
setNewPaymentMethod(paymentMethod);
await ConfirmSetupIntent();
}
};
const ConfirmSetupIntent = async () => {
Log.debug('ConfirmSetupIntent', clientSecret, newPaymentMethod);
const { setupIntent, error } = await confirmSetupIntent(clientSecret, {
paymentMethodType: 'Card',
newPaymentMethod,
});
if (error) {
Log.error('Error when confirming setup intent', error);
} else if (setupIntent) {
const payload = {
...setupIntent,
...newPaymentMethod,
};
props.addStripeAccountAction(payload);
Log.debug('Done adding Google Pay method');
if (fromRoute) {
navigation.navigate('BookingSummary', {
newPaymentMethod,
});
}
}
};
yeah I think you need to call a specific overload of confirmSetupIntent that take an ID. Let me look.
Thank you, I've only found others mention this error when using a custom UI component to collect PM, which doesn't really apply to me
I think it's something like this
const {error} = await confirmSetupIntent(clientSecret, {
paymentMethodType: 'Card',
paymentMethodData: {
paymentMethodId: "pm_xxx", // probably newPaymentMethod.id in your case
},
});
since you need to use paymentMethodId specifically https://stripe.dev/stripe-react-native/api-reference/modules/PaymentMethod.html#CardParams