简体   繁体   中英

Is it PCI compliant to create PaymentIntent directly from my Flutter app?

I have tried different ways to handle payment via no webhook flow, but the only solution is to call stripe API directly from my dart code as follows:

var response = await http.post(
        Uri.parse('https://api.stripe.com/v1/payment_intents'),
        body: {
          'amount': _calculateAmount(amount),
          'currency': currency,
          'payment_method_types[]': 'card',
          'description': description,
          'receipt_email': email,
        },
        headers: {
          'Authorization': 'Bearer ${AppConfig.instance.stripeSecretKey}',
          'Content-Type': 'application/x-www-form-urlencoded'
        },
      );

is my code still PCI compliant and properly secured to use in production?

Your code is still PCI compliant, but not secure . Secret key must be stored securely in your web or mobile app's server-side code (such as in an environment variable or credential management system). Calling from Dart means you are exposing your credential to the whole world. It's explained in Stripe Doc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM