jonasbark / flutter_stripe_payment

[DISCONTINUED] A flutter plugin with stripe payment plugin integration
MIT License
309 stars 244 forks source link

Transaction Failed: 'package:stripe_payment/src/stripe_payment.dart': Failed assertion: line 157 pos 12: 'intent.clientSecret !=null': is not true. #316

Closed ketancts closed 3 years ago

ketancts commented 3 years ago

Transaction Failed: 'package:stripe_payment/src/stripe_payment.dart': Failed assertion: line 157 pos 12: 'intent.clientSecret !=null': is not true. Error

deep1931 commented 3 years ago

Hello, have you found the solution to this issue?

Regards

ketancts commented 3 years ago

Yes @deep1931. Just verify your stripe_publishable_key and stripe_secret_key are correct.

Also, if you have added //'metadata': '', then comment it because empty map also produced

static Future<Map<String, dynamic>> createPaymentIntent( String amount, String currency) async { try { Map<String, dynamic> body = { 'amount': amount, 'currency': currency, 'payment_method_types[]': 'card', //'metadata': '', }; var response = await http.post(Uri.parse(StripeService.paymentApiUrl), body: body, headers: StripeService.headers); return jsonDecode(response.body); } catch (err) { print('err charging user: ${err.toString()}'); } return null; }