stripe / stripe-terminal-react-native

React Native SDK for Stripe Terminal
https://stripe.com/docs/terminal/payments/setup-integration?terminal-sdk-platform=react-native
MIT License
108 stars 50 forks source link

Tap to Pay screen not showing #506

Closed sharifashraful closed 1 year ago

sharifashraful commented 1 year ago

Describe the bug

i successfully created payment intent by react native terminal sdk. but tap to pay screen does not show when i call collectPaymentMethod function.

Expected behavior tap to pay screen should display

Screenshots image

Stripe Terminal React Native SDK version

"^0.0.1-beta.12",

Smartphone (please complete the following information):

Dhaval1905 commented 1 year ago

@sharifashraful Would you please share your code here so I can review it and help you.

sharifashraful commented 1 year ago

`const connectToLocalMobileReader = async reader => {

//await disconnectReader();

if(!connectedReader) {
  const { reader: _connectedReader, error } = await connectLocalMobileReader({
    reader,
    locationId: reader.locationId || "tml_FH2vHAzk7D4O2W"//reader.locationId,
    // onBehalfOf: testAcctId,
  });

  if (error) {
    console.log('connectLocalMobileReader error:', error);

    return;
  } else {
    console.log('Reader connected successfully', _connectedReader);
    setConnectedReader(_connectedReader)
  }
}

const paymentMethodOptions = {

  requestExtendedAuthorization: true,
  requestIncrementalAuthorizationSupport: true

};

const {paymentIntent} = await createPaymentIntent({
  amount: 100,
  currency: 'usd',
  onBehalfOf: "acct_1MxqpTCYC35RGLAP",
  transferDataDestination: "acct_1MxqpTCYC35RGLAP",
  applicationFeeAmount: 20,
  paymentMethodTypes: ['card_present'],
  paymentMethodOptions: paymentMethodOptions,
  capture_method: 'manual'
});

// await setSimulatedCard("4242424242424242")

console.log(paymentIntent)
setDebug(JSON.stringify(paymentIntent))

const {paymentIntent: collectedPaymentIntent} = await collectPaymentMethod({
  paymentIntentId: paymentIntent.id,
});

if(!collectedPaymentIntent) {
  await cancelCollectPaymentMethod();
  // await cancelPaymentIntent()

  return;
}

setDebug(JSON.stringify(collectedPaymentIntent))

const {paymentIntent: processedPaymentIntent} = await processPayment(collectedPaymentIntent.id);

console.log(processedPaymentIntent)
setDebug(JSON.stringify(processedPaymentIntent))

}`

@Dhaval1905

Dhaval1905 commented 1 year ago

Which kind of reader are you use to connect?

@sharifashraful

sharifashraful commented 1 year ago

tap to pay

await discoverReaders({ discoveryMethod: 'localMobile', simulated: false, });

reader info image

Dhaval1905 commented 1 year ago

Also one last thing I want to know that you are user credit or debit card for scan purpose correct?

sharifashraful commented 1 year ago

yes for contactless card

sharifashraful commented 1 year ago

tap to pay

await discoverReaders({ discoveryMethod: 'localMobile', simulated: false, });

reader info image

why reader status is offline and id is null??

Dhaval1905 commented 1 year ago

So may I know your status? Is like you are testing on live mode or test mode. Also share your whole code or github repo where it is live.

sharifashraful commented 1 year ago

@Dhaval1905

real device - reader firing event , but still tap to pay UI not coming. image

sharifashraful commented 1 year ago

fixed..

there was conflict between StripeTerminalProvider and StripeProvider

i used like this


<StripeTerminalProvider>
 <StripeProvider>
....
...