#noroup_api

1 messages · Page 1 of 1 (latest)

viral hazelBOT
#

đź‘‹ Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1386868835910418482

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

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.

lime vine
#
      const { error, paymentIntent } = await confirmPayment(clientSecret, {
        paymentMethodType: 'Card',
        billingDetails: {
          email: user.email
        },
      });    
#

Error confirming payment {"code": "Failed", "declineCode": null, "localizedMessage": "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)", "message": "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)", "stripeErrorCode": null, "type": null}

oak moat
#

Hi! Do you have the Payment Intent ID?

lime vine
#

Hi! Let me get that for you

#

pi_3RdLB6LbE4j2Km3D17Flp22j @oak moat

oak moat
#

Are you creating an iOS or Android app?

lime vine
#

I am testing on an IOS device

oak moat
#

Sorry still looking into this!

lime vine
#

don't worry, the code looks correct?

oak moat
#

Do you have the rest of your code?

lime vine
#
import { useStripe, CardField, StripeProvider } from '@stripe/stripe-react-native';


  const { confirmPayment } = useStripe();

  // Close keyboard if card details complete

  useEffect(()=> {
    if(cardDetails?.complete){
      Keyboard.dismiss();
    }
  }, [cardDetails])


  const checkoutFunction = async () =>  {
    setLoading(true)

    //  Ensure card details are correct / complete

    if (!cardDetails?.complete) {
      Alert.alert('Invalid Card', 'Please enter complete card details.');
      setLoading(false);
      return;
    }

    // Deduct stock, create payment intent

    const purchaseResp = await purchaseAPI(cart)

    if(purchaseResp?.statusCode == 200){

      const clientSecret = JSON.parse(purchaseResp.body).clientSecret

      // Check selected card details, select appropriate payment method

      const { error, paymentIntent } = await confirmPayment(clientSecret, {
        paymentMethodType: 'Card',
        paymentMethodData: {
          billingDetails: {
            email: user.email,
          },
        },
      });
      
      if (error) {
        console.log('Error confirming payment', error);
        Alert.alert('Payment Failed', error.message);
      } else {
        console.log('PaymentIntent', paymentIntent);
        Alert.alert('Payment Successful', 'Your payment was completed.');
        closeSheet();
      }

    }
    setLoading(false)
  }
#

That's really all there is to it

#
          <CardField
          postalCodeEnabled={false}
          placeholder={{
            number: '4242 4242 4242 4242',
            expiration: 'MM/YY',
            cvc: 'CVC'
          }}
          cardStyle={styles.card}
          style={styles.cardField}
          onCardChange={setCardDetails}
        />
oak moat
#

Thanks for waiting! The error code kCFErrorDomainCFNetwork1 indicates there is a network-related issue, specifically indicating a timeout that is likely due to connectivity problems with your simulator. I recommend checking to ensure your simulator has internet connectivity. You should try restarting the simulator and attempting the action again.

lime vine
#

I’ll try again but I’m not running this on a simulator. This is my physical iPhone

#

LOG Error confirming payment {"code": "Failed", "declineCode": null, "localizedMessage": "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)", "message": "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)", "stripeErrorCode": null, "type": null}

#

Yep, same issue

#

I will look into this again tomorrow I must go now

oak moat
#

You can try to restart the iPhone ans also try with a few different networks.