#jesuisilya

1 messages · Page 1 of 1 (latest)

rotund narwhalBOT
subtle musk
#

Here's full code

import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { PlatformPayButton, isPlatformPaySupported } from '@stripe/stripe-react-native';
import {
  addStripeAccount,
  generateStripePaymentIntentDetails,
} from '../../resources/user/user.actions';
import {
  selectStripePaymentIntent,
  selectUserProfile,
} from '../../resources/user/user.selectors';
import Log from '../../../log.config';

const ApplePay = ({ navigation, route, setLoading, ...props }) => {
  const [isApplePaySupported, setIsApplePaySupported] = useState(false);
  
  useEffect(() => {
    Log.debug('Is Apple Pay Supported?', isApplePaySupported);
  }, [isApplePaySupported]);

  useEffect(() => {
    (async function () {
      setIsApplePaySupported(await isPlatformPaySupported());
    })();
  }, []);

  return (
    <View>
      { isApplePaySupported && (
        <PlatformPayButton
          type="standard"
          onPress={() => {
            
          }}
          style={{
            height: 40,
            marginHorizontal: 20,
          }}
        />
      )}
    </View>
  );
};
sharp badger
#

Thanks for sharing let me check...

#

iPhone 12 (iOS 16)
Are you using a virtual device or a real device ?

subtle musk
#

A real device

#

I'll try this sample

sharp badger
subtle musk
sharp badger
#

it is on real devices, otherwise you can use virtual device on your mac in order to use the virtual card set there.

subtle musk
#

Okay, I've added a card to apple pay but isPlatformPaySupported still showing as false when I print the output

sharp badger
#

Did you tried to use that card with Apple Pay other than your app?

subtle musk
#

No, do you think it's a problem with the card?

sharp badger
#

It could be yeah. But in all case, you need to make sure that you have a working Apple Pay in your real device first, before testing your integration.

subtle musk
#

Just made an order with apple pay somewhere else, so it is 100% working on this device