Add trial period in flutter stripe. When i added parameter trial days in createPaymentIntend than successfuly payment without stripe take card details Expectation is when i clicked to payment a payment sheet will open and take card details and save and enable subscription with trial period but amount can't be cut , amount will cut automatically after trial period end. Future<Map<String, dynamic>?> createSubscriptionIntent(String priceId, String customerId) async { // Get current time in seconds since epoch int? trialEnd; int currentTime = DateTime.now().millisecondsSinceEpoch ~/ 1000; // Calculate trial end time trialEnd = currentTime + (2 * 24 * 60 * 60); // Convert days to seconds try { Map<String, dynamic> body = { 'customer': customerId, 'items[0][price]': priceId, // 'trial_end': trialEnd.toString(), 'payment_behavior': 'default_incomplete', 'expand[]': 'latest_invoice.payment_intent', }; var response = await http.post( Uri.parse('https://api.stripe.com/v1/subscriptions'), headers: { 'Authorization': 'Bearer $key', // Replace with your Stripe Secret Key 'Content-Type': 'application/x-www-form-urlencoded', }, body: body, ); var jsonResponse = json.decode(response.body); print('Subscription Response: $jsonResponse'); if (jsonResponse.containsKey('latest_invoice')) { var paymentIntent = jsonResponse['latest_invoice']['payment_intent']; if (paymentIntent != null && paymentIntent.containsKey('client_secret')) { print('Subscription Response: retrun '); return paymentIntent; // Return the payment intent as a Map } else { throw Exception("Invalid subscription response: missing payment intent"); } } else { throw Exception("Invalid server response: missing invoice"); } } catch (e) { print('Error creating subscription: $e'); throw e; } } Add trial period in flutter stripe. Expectation is when i clicked to payment a payment sheet will open and take card details and save and enable subscription with trial period but amount can't be cut , amount will cut automatically after trial period end. Continue reading...