PaymentMethodType Error When Setting Up Stripe Payment in React Native with Python API

I’m trying to set up Stripe payments in my React Native application with a Python Flask backend, but I keep running into an issue. The error message says “You must provide paymentMethodType” even though I think I configured everything correctly.

Here’s my Python backend endpoint:

@app.route("/process-stripe-payment", methods=["POST"])
def handle_payment_request():
    stripe.api_key = stripe_secret_key
    try:
        request_data = json.loads(request.data)
        if "total" in request_data:
            try:
                payment_intent = stripe.PaymentIntent.create(
                    amount=int(request_data["total"] * 100),
                    currency=request_data["currency_code"],
                    payment_method_types=['card'],
                )
                return jsonify({"secret": payment_intent["client_secret"]})
            except ValueError as error:
                return jsonify(error=str(error))
        else:
            return jsonify(error="Missing payment amount")
    except Exception as error:
        return jsonify(error=str(error))

And here’s how I’m calling it from React Native:

const getClientSecret = async () => {
  const apiResponse = await fetch(`https://myapi.example.com/process-stripe-payment`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      currency_code: 'USD',
      total: orderAmount,
    }),
  });
  const { secret } = await apiResponse.json();
  return secret;
};

const { confirmPayment, loading } = useConfirmPayment();
const processPayment = async () => {
    const secret = await getClientSecret();
    const customerInfo = {
    email: 'customer@example.com',
    phone: '+1234567890',
    addressCity: 'New York',
    addressCountry: 'US',
    addressLine1: '123 Main Street',
    addressLine2: 'Apt 4B',
    addressPostalCode: '10001',
  };
    const { error, paymentIntent } = await confirmPayment(secret, {
    type: 'Card',
    billingDetails: customerInfo,
  });
    if (error) {
    console.log(error)
  } else if (paymentIntent) {
    console.log(paymentIntent)
  }
};

I can’t figure out what’s causing this paymentMethodType error. Any ideas what I might be missing?

are u checking for backend errors? if the fetch fails or if it returns an error instead of the secret, it could be causing this issue. does it happen every time? try logging the secret value before confirmPayment to see where the problem is.

This is a mismatch between your backend and React Native setup. Your Python backend creates a PaymentIntent with payment_method_types=['card'], but the RN Stripe SDK needs the payment method type during confirmation. Change type: 'Card' to paymentMethodType: 'Card' in your confirmPayment call. Also fix your method structure - use paymentMethod: { type: 'Card', billingDetails: customerInfo } instead of having billingDetails separate. I hit this exact error migrating from an older version and restructuring the payment method object fixed it right away.

check your stripe rn version - older versions used different syntax for confirmPayment. you might need to specify paymentMethodType separately. try adding paymentMethodType: 'Card' next to the type field, or just update to the latest @stripe/stripe-react-native.