cancelScheduledChanges method

Future<Response<RazorpaySubscription>> cancelScheduledChanges({
  1. required String subscriptionId,
  2. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpaySubscription>?
    )?,
})

Cancel Scheduled Changes

@param subscriptionId - The unique identifier of the Subscription.

Implementation

Future<Response<RazorpaySubscription>> cancelScheduledChanges({
  required String subscriptionId,
  void Function(RazorpayApiException?, Response<RazorpaySubscription>?)?
      callback,
}) async {
  if (subscriptionId.isEmpty) {
    throw ArgumentError(MISSING_ID_ERROR);
  }
  final url = '$BASE_URL/$subscriptionId/cancel_scheduled_changes';
  return api.post<RazorpaySubscription>(
    // Assuming it returns the subscription object
    {'url': url},
    fromJsonFactory: RazorpaySubscription.fromJson,
    callback: callback,
  );
}