jonasbark/flutter_stripe_payment

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

ketancts opened this issue · 2 comments

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

Hello,
have you found the solution to this issue?

Regards

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;
}