#carelessrabbit

1 messages · Page 1 of 1 (latest)

carmine pelicanBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

quaint hound
#

Hi there, can you tell me what problem that you are trying to resolve?

granite harbor
quaint hound
#

It's a long thread, it'll be easier and faster for me to start the troubleshooting if you can tell me what goal you want to achieve here.

granite harbor
#

Could you read then just my first post?

#

I am trying integrate Apple Pay via Stripe with react native via expo but I am stuck with one error. I am out of options on what it could be. Can anyone suggest directions on debugging, or maybe know the answer?

I followed guide from https://stripe.com/docs/apple-pay?platform=react-native#handle-payment
I have done very exact same solution: https://codefile.io/f/1qbW7wMwLa

However, when I click pay using confirmPlatformPayPayment or confirmPlatformPaySetupIntent, I get exact same error:
error: {"stripeErrorCode":null,"declineCode":null,"localizedMessage":"The payment has been canceled","message":"The payment has been canceled","type":null,"code":"Canceled"}

Addtional info:

On server side, my payment intent looks like this:
const paymentIntentOptions: Stripe.PaymentIntentCreateParams = {
amount: fullAmount,
currency: currency,
customer: stripeId,
application_fee_amount: fee,
transfer_data: {
destination,
},
metadata: {
checkInId,
checkOutTime,
},
};

I don't see any logs from Stripe Dashboard, upon clicking pay it does not log on stripe end.

Versions:
"expo": "^48.0.0"
"@stripe/stripe-react-native": "0.23.3"
Stripe default API: 2019-05-16
Tested device using expo-dev-client: iphone 13 pro max
Tested ios version: 16.6.1
"expo-dev-client": "~2.2.1"

Allow customers to securely make payments using Apple Pay on their iPhone, iPad, or Apple Watch.

#

any ideas?

quaint hound
#

what's the payment intent ID?

granite harbor
#

I think this one: pi_3O9EdwKwGkja34pa1vCgcrFY

It's payment in test environment.

#

Could you go briefly through thread cause your asking same questions

#

Through a bit additional look, I found that I am getting first error saying:

{"stripeErrorCode":null,"declineCode":null,"localizedMessage":"Payment not completed","message":"Payment not completed","type":null,"code":"Failed"}

Then afterwards I am getting:

{"stripeErrorCode":null,"declineCode":null,"localizedMessage":"The payment has been canceled","message":"The payment has been canceled","type":null,"code":"Canceled"}

quaint hound
#

Is this the correct paymentIntent ID? I don't see any request from your react native app to confirm this payment intent.

granite harbor
#

it's in test env

quaint hound
#

Are you using expo go?

granite harbor
#

pi_3O9EdwKwGkja34pa1vCgcrFY

#

I am using eas build

quaint hound
#

I don't see any confirmation request for pi_3O9EdwKwGkja34pa1vCgcrFY either.

granite harbor
#

this is my payment intent on test env

quaint hound
granite harbor
#

true

#
const CheckoutPaymentPlatform: FC<any> =
  useEffect(() => {
    (async function () {
      setPlatformPaySupport(await isPlatformPaySupported());
    })();
  }, [isPlatformPaySupported]);
  useEffect(() => {
    (async function () {
      const clientSecret = await fetch();
      setClientSecret(clientSecret);
    })();
  }, []);

  const pay = async () => {
    const { error } = await confirmPlatformPayPayment(
      clientSecret,
      {
        googlePay: {
          merchantCountryCode: 'GB',
          testEnv: true,
          currencyCode: 'GBP',
        },
        applePay: {
          cartItems: [
            {
              label: 'parking',
              amount: billAmount,
              paymentType: PlatformPay.PaymentType.Immediate,
            },
          ],
          merchantCountryCode: 'GB',
          currencyCode: 'GBP',
        },
      }
    );
    if (error) {
      // handle error
      console.error("error: ", JSON.stringify(error))
    } else {
      Alert.alert('Success', 'Check the logs for payment intent details.');
    }
  };

  return (
    <View
      style={Styles.wrap}
    >
      <View style={Styles.buttonContainer}>
        {platformPaySupport && <PlatformPayButton
          onPress={pay}
          type={PlatformPay.ButtonType.Checkout}
          appearance={PlatformPay.ButtonStyle.Black}
          borderRadius={4}
          style={{
            width: '100%',
            height: 50,
          }}
        />}
      </View>
    </View>
  )
}```
quaint hound
granite harbor
#

yes, I did

#

<StripeProvider publishableKey={STRIPE_PUBLIC_KEY} merchantIdentifier={MERCHANT_ID}> </StripeProvider>

#

that how I do it

quaint hound
#

Ok, did you see the Apple Pay payment sheet popping up after calling confirmPlatformPayment ?

granite harbor
#

no, I haven't

#

it fails immedietly

quaint hound
#

And do you have a valid card added to your Apple Pay wallet?

granite harbor
#

yes, i do, I use apple pay daily

#

It's UK card, and I am from UK

quaint hound
#

Ok, do you have the same problem with Google Pay?

granite harbor
#

I haven't tested it

#

my goal to do apple pay first

quaint hound
#

I noticed that you are using cartItems in confirmPlatformPayPayment, but this params is only added in react-native sdk 0.24.0, and you are using 0.23.3

granite harbor
#

are you sure?

quaint hound
#

The old param name is paymentSummaryItems

#

Check the changelog

granite harbor
#

but why do I see when I go into the function?

#

how confirmPlatformPayPayment looked on 23.3?

#

I can't update higher since expo 48 can only support 23.3, and for higher one it requires migration.

I would appreaciate if you could me understand how confirmPlatformPayPayment should look like?

quaint hound
#

What' the valude of billAmount ?

granite harbor
#

it would string would like 101, and then converted to number, and then divided by 100 and then converted to string again.

from "101" you would get "1.01"

quaint hound
#

Do you see any errors from the xcode log? npx react-native log-ios

granite harbor
#

Will it work on development client?

#

I am using real device

quaint hound
#

It would work on development build.

granite harbor
#

error No active iOS device found

#

I am getting this error

quaint hound
#

Is your test device connected to your Mac?

granite harbor
#

no it's not should it be?

quaint hound
#

yes you need to connect your test device in order to get logs

granite harbor
#

i sent dev client to my device and fetching the javascript throught LAN connection

#

does it have to special connection and setting?

#

I am still getting same error?

quaint hound
#

You can learn more about native debugging here.

granite harbor
#

Could old stripe API version be an issue?

quaint hound
#

I don't think so.

#

I'd suggest you to get the native debugging working and see if the xcode logs could give you anything useful.

granite harbor
#

I have migrated expo version from 48 to 49

#

Which allowed me to update from 23.3 to 28 stripe

#

However, my app closes after I attempt to pay, for payment intent in test env. Why?

I see wallet, I can click and verify with face ID my card. I see it's attempting to use my real card. I confirm as usual but app gets closed.