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
These two params are not of boolean value.
You can refer to the example code and see how to configure
applePay
andgooglePay
params.applePay
acceptsPaymentSheetApplePay
type whereasgooglePay
acceptsPaymentSheetGooglePay
type.You may refer to the example code for
applePay
andgooglePay
toinitPaymentSheet
here.