createexternaltransaction method

Future<ExternalTransaction> createexternaltransaction(
  1. ExternalTransaction request,
  2. String parent, {
  3. String? externalTransactionId,
  4. String? $fields,
})

Creates a new external transaction.

request - The metadata request object.

Request parameters:

parent - Required. The parent resource where this external transaction will be created. Format: applications/{package_name} Value must have pattern ^applications/\[^/\]+$.

externalTransactionId - Required. The id to use for the external transaction. Must be unique across all other transactions for the app. This value should be 1-63 characters and valid characters are /a-z0-9_-/. Do not use this field to store any Personally Identifiable Information (PII) such as emails. Attempting to store PII in this field may result in requests being blocked.

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

Completes with a ExternalTransaction.

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<ExternalTransaction> createexternaltransaction(
  ExternalTransaction request,
  core.String parent, {
  core.String? externalTransactionId,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (externalTransactionId != null)
      'externalTransactionId': [externalTransactionId],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'androidpublisher/v3/' +
      core.Uri.encodeFull('$parent') +
      '/externalTransactions';

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