#Tony_n

1 messages ยท Page 1 of 1 (latest)

opaque zodiacBOT
terse pawn
#

I'm not going to review the older threads. Can you summarize your question here?

stoic badger
#

Clicking on it would take you right to it..

#

Hello, I am working on integrating stripe with react native. I have pretty much finished the integration successfully but one issue is that I cannot get the payment info from the payment sheet once a user has filled out the card. I get no error and everything works other than the payment info being undefined which based on my understanding it should not be.

I created an issue here but have yet to here a response back https://github.com/stripe/stripe-react-native/issues/1159

terse pawn
stoic badger
#

Yep, everything works perfectly. I can add the card to the paymentIntent and charge it and transfer money to my contractors

#

I am fairly certain it is a bug

terse pawn
#

Which step, in this doc, is not doing what you expect?

stoic badger
#

Based on the typescript defintions if there is no error then I should get the info back

#

const { error: openSheetError, paymentOption } = await presentPaymentSheet();

#

In this doc it only uses error

#

But on another doc and in the library itself it has paymentOption

#

Which comes back undefined even when there is no error

#

Basically I just want to show the card type and expiry to the user

#

So they have feedback on what card they added in case they want to edit

calm sparrow
#

๐Ÿ‘‹ stepping in as Snufkin needs to step away

#

Fairly certain this is expected currently

#

But let me double check

stoic badger
#

Fair enough. Is there a way to show payment details then?

calm sparrow
#

But it won't have your card type/expiry

stoic badger
#

Yeah that is what the typings say

calm sparrow
#

You would retrieve that server-side

stoic badger
#

label and image is good enough I suppose

calm sparrow
#

Okay so you are saying that it is just undefined currently

stoic badger
#

Correct

calm sparrow
#

And you aren't seeing any label/image

stoic badger
#

Yep

calm sparrow
#

Can you share your full code snippet?

#

And can you provide a PaymentIntent that you tested with?

stoic badger
#

Yeah one moment

#

async function addPayment() {
setCardPaymentLoading(true);
const { total } = getTotalAdventureAmount();
let body = { amount: total * 100, paymentIntentId };
try {
const response = await fetch(${supabaseFunctionsUrl}/stripe?method=initPaymentSheet, {
method: 'POST',
headers: {
authorization: Bearer ${session?.access_token},
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});
const data = await response.json();
const { paymentIntent, ephemeralKey, customer, paymentIntentId: newIntent } = data;

  // deleted last payment type so need to disable (for edit flow)
  setDisabled(true);

  const { error: e } = await initPaymentSheet({
    customerId: customer,
    customerEphemeralKeySecret: ephemeralKey,
    paymentIntentClientSecret: paymentIntent,
    merchantDisplayName: 'Beta Bridge Inc.',
  });

  if (e) {
    throw new Error(e.message);
  }

  const { error: openSheetError, paymentOption } = await presentPaymentSheet();
  console.log('adsf', paymentOption, openSheetError)

  if (openSheetError?.code === 'Canceled') {
    return setCardPaymentLoading(false);
  }

  if (openSheetError) {
    throw new Error(openSheetError.message);
  }

  setCardPaymentInfo(paymentOption);
  setPaymentIntentId(newIntent);
  setDisabled(false);
  setCardPaymentLoading(false);
} catch (e) {
  showErrorModal(e?.message);
  return setCardPaymentLoading(false);
}

}

calm sparrow
#

And what version of the RN SDK are you using?

stoic badger
#

"@stripe/stripe-react-native": "^0.18.1",

calm sparrow
#

Thanks

stoic badger
#

Looking for the paymentintent now

calm sparrow
#

Great

#

You could also run a fresh test

#

That might be best tbh

stoic badger
#

ok one sec

calm sparrow
#

๐Ÿ‘

stoic badger
#

pi_3LrPpCA5764Qahvb1QSZcDZi_secret_zum3qWITT6BB2mU8NAJVixBOn

#

Just occurred with a payment intent with an id of the above

#

I suppose I could just use a server side endpoint to get the info as a workaround

#

I will do that for now

calm sparrow
#

That is mostly what you want to do any way. The image is returned as a base64 string that you then have to handle

#

And you won't get last4 or anything clientside

#

So just grabbing it serverside and returning it is really the best route

#

I'll still look into why image/label isn't being returned

stoic badger
#

Ok thank you!

calm sparrow
#

Can you do one test for me and just do const result = await presentPaymentSheet(); console.log("result: ", result);

stoic badger
#

result: {paymentOption: undefined}

#

Did not even have the error key in there

#

I am also using test keys if that makes a difference

calm sparrow
#

Nah shouldn't make a difference

#

Okay I'll need to repro myself... my sample is on 0.16.0 so I'll test it out with newer version later today and file a ticket if I can repro

#

But really, you should just ignore this and as long as you don't get an error you should fetch server-side for the info

stoic badger
#

Sounds good thank you for the guidance and for looking at this