#yaromyr
1 messages · Page 1 of 1 (latest)
hi! can you share the exact code that's giving that error?
and the PaymentIntent ID pi_xxxx that's involved
Yes,
Here is the function for capturing payment:
const handleTapToPay = async (requestData: ManualRequestData) => {
try {
if (!user?.company?.stripeAccountId)
throw new Error('No stripe account id');
await setSimulatedCard('4242424242424242');
const requestDto = {
stockNumber: requestData.description,
customerName: requestData.name || 'test',
...(requestData.type === 'email'
? {
customerEmail: requestData.email,
}
: {
customerPhone: requestData.phone,
}),
};
console.log('requestDto', requestDto);
const { clientSecret } = await PaymentAPI.collectReaderPayment({
amount: requestData.amount,
...requestDto,
});
const paymentIntentResponse = await retrievePaymentIntent(clientSecret);
if (paymentIntentResponse.error || !paymentIntentResponse.paymentIntent)
throw new Error(
paymentIntentResponse.error?.message ||
'Failed to retrieve payment intent',
);
console.log('paymentIntentResponse', paymentIntentResponse);
const paymentMethodResponse = await collectPaymentMethod({
paymentIntentId: paymentIntentResponse.paymentIntent.id,
});
if (paymentMethodResponse.error || !paymentMethodResponse.paymentIntent)
throw new Error(
paymentMethodResponse.error?.message ||
'Failed to collect payment method',
);
console.log('paymentMethodResponse', paymentMethodResponse);
const processPaymentResponse = await processPayment(
paymentMethodResponse.paymentIntent.id,
);
if (processPaymentResponse.error || !processPaymentResponse.paymentIntent)
throw new Error(
processPaymentResponse.error?.message || 'Failed to process payment',
);
await PaymentAPI.captureReaderPayment({
paymentIntentId: processPaymentResponse.paymentIntent.id,
...requestDto,
});
return true;
} catch (error) {
console.log('error', error);
}
};
paymentIntentResponse {"error": undefined, "paymentIntent": {"amount": 100000, "charges": [], "created": "1684243111000", "currency": "usd", "id": "pi_3N8NlrFsEyguhAmS0NPUGMy2", "status": "requiresPaymentMethod"}}
Hi 👋 jumping in as my teammate needs to step away soon. Looking at the response provided there, I'm not seeing an error in it.
Is that the response that corresponds with the error you described in your initial message?
This is retrievePaymentIntent response. collectPaymentMethod is the one that returns an error: Error: A required parameter was invalid or missing
What behavior do you see if you change:
paymentIntentId: paymentIntentResponse.paymentIntent.id,
});```
to:
```const paymentMethodResponse = await collectPaymentMethod(paymentIntentResponse.paymentIntent.id); ```
I see a TypeScript error: "Argument of type 'string' is not assignable to parameter of type 'CollectPaymentMethodParams'.ts(2345)". collectPaymentMethod from useStripeTerminal from '@stripe/stripe-terminal-react-native' requires this type of argument: type CollectPaymentMethodParams = {
paymentIntentId: string;
skipTipping?: boolean;
tipEligibleAmount?: number;
};
If I ignore that error, collectPaymentMethod returns new error: [Error: You must provide paymentIntentId.]
Sorry, just noticed something and want to take a step back. You mentioned you're trying to implement our Tap to Pay functionality, but I don't believe that functionality has been added to our React Native SDK yet.
Looks like it was added in version 2.14.0 of our iOS Terminal SDK:
https://github.com/stripe/stripe-terminal-ios/releases/tag/v2.14.0
and our React Native Terminal SDK (which is still in beta) is only including up to version 2.13.0 of the iOS Terminal SDK:
https://github.com/stripe/stripe-terminal-react-native/releases?q=&expanded=true
Minimum deployment target changed from iOS 10.0 to iOS 11.0
Added support for Tap to Pay on iPhone.
Added new SCPTippingConfiguration property on SCPCollectConfiguration, which allows for per-trans...
Yes, I've patched stripe-terminal-react-native with current version of main branch from stripe-terminal-react-native. It uses 2.17.1 iOS Terminal SDK, which has Tap to Pay feature. Sorry for not mentioning this.
If the error that I'm receiving is not something obvious from your point of view, I'll wait for stripe-terminal-react-native package update, maybe it will fix this.
Thank you.
Gotcha, I'm really not sure how that package is going to behave if you start altering it.