Update: 2026-05-16 01:40:56
This commit is contained in:
@@ -11,6 +11,7 @@ class SubscriptionController extends GetxController {
|
||||
var isLoading = true.obs;
|
||||
var isCreatingPayment = false.obs;
|
||||
var activePaymentRequest = Rxn<Map<String, dynamic>>();
|
||||
var isAnnual = true.obs; // Toggle between Monthly and Annual
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
@@ -69,7 +70,11 @@ class SubscriptionController extends GetxController {
|
||||
Future<Map<String, dynamic>?> createPaymentRequest(String planId) async {
|
||||
try {
|
||||
isCreatingPayment.value = true;
|
||||
final res = await DioClient().client.post('payments/create', data: {'plan_id': planId});
|
||||
final cycle = isAnnual.value ? 'annual' : 'monthly';
|
||||
final res = await DioClient().client.post('payments/create', data: {
|
||||
'plan_id': planId,
|
||||
'billing_cycle': cycle,
|
||||
});
|
||||
if (res.data['success'] == true && res.data['data'] != null) {
|
||||
final result = Map<String, dynamic>.from(res.data['data']);
|
||||
activePaymentRequest.value = result;
|
||||
|
||||
Reference in New Issue
Block a user