startPaidService method

Future<Subscription> startPaidService(
  1. String customerId,
  2. String subscriptionId, {
  3. String? $fields,
})

Immediately move a 30-day free trial subscription to a paid service subscription.

This method is only applicable if a payment plan has already been set up for the 30-day trial subscription. For more information, see [manage subscriptions](/admin-sdk/reseller/v1/how-tos/manage_subscriptions#paid_service).

Request parameters:

customerId - This can be either the customer's primary domain name or the customer's unique identifier. If the domain name for a customer changes, the old domain name cannot be used to access the customer, but the customer's unique identifier (as returned by the API) can always be used. We recommend storing the unique identifier in your systems where applicable.

subscriptionId - This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Subscription.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Subscription> startPaidService(
  core.String customerId,
  core.String subscriptionId, {
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'apps/reseller/v1/customers/' +
      commons.escapeVariable('$customerId') +
      '/subscriptions/' +
      commons.escapeVariable('$subscriptionId') +
      '/startPaidService';

  final response_ = await _requester.request(
    url_,
    'POST',
    queryParams: queryParams_,
  );
  return Subscription.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}