Search code examples
flutterdartstripe-paymentsflutter-stripe

Flutter Stripe payment intent without secret-key


I'm trying to add Stripe payment intent in flutter but the issue is in the new library flutter_stripe: ^7.0.0 requires a secret key but the secret key is handled in the backend API(server).

I did it earlier with stripe_payment but now the library stopped working. So if you guys have any solution let me know. Thanks


Solution

  •  final paymentIntent = await Stripe.instance.confirmPayment(
          clientSecret,
          const PaymentMethodParams.card(
            paymentMethodData: PaymentMethodData(),
          ));
      // ignore: use_build_context_synchronously
      ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
          content: Text('Success!: The payment was confirmed successfully!')));
      NavigationHelper.pushReplacement(context, BottomNavBody(data: widget.data,));
    

    This is the code for doing payment intent while stripe secret key is handled by server side.