#yaromyr

1 messages · Page 1 of 1 (latest)

north krakenBOT
stray rampart
#

hi! can you share the exact code that's giving that error?

#

and the PaymentIntent ID pi_xxxx that's involved

buoyant canopy
# stray rampart hi! can you share the exact code that's giving that error?

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);
buoyant canopy
# stray rampart hi! can you share the exact code that's giving that error?

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);
}

};

buoyant canopy
chrome moss
#

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?

buoyant canopy
chrome moss
#

What behavior do you see if you change:

        paymentIntentId: paymentIntentResponse.paymentIntent.id,
      });```
to:
```const paymentMethodResponse = await collectPaymentMethod(paymentIntentResponse.paymentIntent.id); ```
buoyant canopy
# chrome moss What behavior do you see if you change: ```const paymentMethodResponse = await c...

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

chrome moss
#

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

GitHub

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

GitHub

React Native SDK for Stripe Terminal. Contribute to stripe/stripe-terminal-react-native development by creating an account on GitHub.

buoyant canopy
chrome moss
#

Gotcha, I'm really not sure how that package is going to behave if you start altering it.