cancelCommerceSubscriptionItemWithHttpInfo method

Future<Response> cancelCommerceSubscriptionItemWithHttpInfo(
  1. String subscriptionItemId, {
  2. bool? endNow,
})

Cancel a subscription item

Cancel a specific subscription item. The subscription item can be canceled immediately or at the end of the current billing period.

Note: This method returns the HTTP Response.

Parameters:

  • String subscriptionItemId (required): The ID of the subscription item to cancel

  • bool endNow: Whether to cancel the subscription immediately (true) or at the end of the current billing period (false, default)

Implementation

Future<http.Response> cancelCommerceSubscriptionItemWithHttpInfo(
  String subscriptionItemId, {
  bool? endNow,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/billing/subscription_items/{subscription_item_id}'
      .replaceAll('{subscription_item_id}', subscriptionItemId);

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (endNow != null) {
    queryParams.addAll(_queryParams('', 'end_now', endNow));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'DELETE',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}