skip to Main Content

I am trying to integrate Stipe Payment Gateway and when I am using SetupPaymentSheetParameters() for card payment then GooglePay and ApplePay is not taking the boolean value, Showing error ‘The argument type ‘bool’ can’t be assigned to the parameter type ‘PaymentSheetApplePay?’.

void makePayment() async{
    //create payment intent
    //init payment Sheet
    //display payment sheet
    paymentIntentData=await createPaymentIntent();
    await Stripe.instance.initPaymentSheet(
      paymentSheetParameters:SetupPaymentSheetParameters(
        paymentIntentClientSecret:paymentIntentData!['client_secret'],
        applePay: true,
        googlePay: true;
        testEnv: true;
        merchantDisplayName: 'ANNIE';
      )
    );
  }

2

Answers


  1. These two params are not of boolean value.

    You can refer to the example code and see how to configure applePay and googlePay params.

    Login or Signup to reply.
  2. applePay accepts PaymentSheetApplePay type whereas googlePay accepts PaymentSheetGooglePay type.

    You may refer to the example code for applePay and googlePay to initPaymentSheet here.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search