extendBillingSubscriptionItemFreeTrial method
Future<SchemasCommerceSubscriptionItem?>
extendBillingSubscriptionItemFreeTrial(
- String subscriptionItemId,
- ExtendFreeTrialRequest extendFreeTrialRequest
Extend free trial for a subscription item
Extends the free trial period for a specific subscription item to the specified timestamp. The subscription item must be currently in a free trial period, and the plan must support free trials. The timestamp must be in the future and not more than 365 days from the end of the current trial period This operation is idempotent - repeated requests with the same timestamp will not change the trial period.
Parameters:
-
String subscriptionItemId (required): The ID of the subscription item to extend the free trial for
-
ExtendFreeTrialRequest extendFreeTrialRequest (required): Parameters for extending the free trial
Implementation
Future<SchemasCommerceSubscriptionItem?>
extendBillingSubscriptionItemFreeTrial(
String subscriptionItemId,
ExtendFreeTrialRequest extendFreeTrialRequest,
) async {
final response = await extendBillingSubscriptionItemFreeTrialWithHttpInfo(
subscriptionItemId,
extendFreeTrialRequest,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty &&
response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'SchemasCommerceSubscriptionItem',
) as SchemasCommerceSubscriptionItem;
}
return null;
}