Skip to content

Latest commit

 

History

History
211 lines (157 loc) · 6.57 KB

transactions.md

File metadata and controls

211 lines (157 loc) · 6.57 KB

Transactions

const transactionsApi = client.transactionsApi;

Class Name

TransactionsApi

Methods

List Transactions

This endpoint is deprecated.

Lists transactions for a particular location.

Transactions include payment information from sales and exchanges and refund information from returns and exchanges.

Max results per page: 50

async listTransactions(
  locationId: string,
  beginTime?: string,
  endTime?: string,
  sortOrder?: string,
  cursor?: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<ListTransactionsResponse>>

Parameters

Parameter Type Tags Description
locationId string Template, Required The ID of the location to list transactions for.
beginTime string | undefined Query, Optional The beginning of the requested reporting period, in RFC 3339 format.

See Date ranges for details on date inclusivity/exclusivity.

Default value: The current time minus one year.
endTime string | undefined Query, Optional The end of the requested reporting period, in RFC 3339 format.

See Date ranges for details on date inclusivity/exclusivity.

Default value: The current time.
sortOrder string | undefined Query, Optional The order in which results are listed in the response (ASC for
oldest first, DESC for newest first).

Default value: DESC
cursor string | undefined Query, Optional A pagination cursor returned by a previous call to this endpoint.
Provide this to retrieve the next set of results for your original query.

See Paginating results for more information.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

ListTransactionsResponse

Example Usage

const locationId = 'location_id4';
try {
  const { result, ...httpResponse } = await transactionsApi.listTransactions(locationId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Retrieve Transaction

This endpoint is deprecated.

Retrieves details for a single transaction.

async retrieveTransaction(
  locationId: string,
  transactionId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<RetrieveTransactionResponse>>

Parameters

Parameter Type Tags Description
locationId string Template, Required The ID of the transaction's associated location.
transactionId string Template, Required The ID of the transaction to retrieve.
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

RetrieveTransactionResponse

Example Usage

const locationId = 'location_id4';
const transactionId = 'transaction_id8';
try {
  const { result, ...httpResponse } = await transactionsApi.retrieveTransaction(locationId, transactionId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Capture Transaction

This endpoint is deprecated.

Captures a transaction that was created with the Charge endpoint with a delay_capture value of true.

See Delayed capture transactions for more information.

async captureTransaction(
  locationId: string,
  transactionId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<CaptureTransactionResponse>>

Parameters

Parameter Type Tags Description
locationId string Template, Required -
transactionId string Template, Required -
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

CaptureTransactionResponse

Example Usage

const locationId = 'location_id4';
const transactionId = 'transaction_id8';
try {
  const { result, ...httpResponse } = await transactionsApi.captureTransaction(locationId, transactionId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}

Void Transaction

This endpoint is deprecated.

Cancels a transaction that was created with the Charge endpoint with a delay_capture value of true.

See Delayed capture transactions for more information.

async voidTransaction(
  locationId: string,
  transactionId: string,
  requestOptions?: RequestOptions
): Promise<ApiResponse<VoidTransactionResponse>>

Parameters

Parameter Type Tags Description
locationId string Template, Required -
transactionId string Template, Required -
requestOptions RequestOptions | undefined Optional Pass additional request options.

Response Type

VoidTransactionResponse

Example Usage

const locationId = 'location_id4';
const transactionId = 'transaction_id8';
try {
  const { result, ...httpResponse } = await transactionsApi.voidTransaction(locationId, transactionId);
  // Get more response info...
  // const { statusCode, headers } = httpResponse;
} catch(error) {
  if (error instanceof ApiError) {
    const errors = error.result;
    // const { statusCode, headers } = error;
  }
}