const terminalApi = client.terminalApi;
TerminalApi
- Create Terminal Action
- Search Terminal Actions
- Get Terminal Action
- Cancel Terminal Action
- Create Terminal Checkout
- Search Terminal Checkouts
- Get Terminal Checkout
- Cancel Terminal Checkout
- Create Terminal Refund
- Search Terminal Refunds
- Get Terminal Refund
- Cancel Terminal Refund
Creates a Terminal action request and sends it to the specified device.
async createTerminalAction(
body: CreateTerminalActionRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CreateTerminalActionResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateTerminalActionRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyActionSaveCardOptions: SaveCardOptions = {
customerId: '{{CUSTOMER_ID}}',
};
bodyActionSaveCardOptions.referenceId = 'user-id-1';
const bodyAction: TerminalAction = {};
bodyAction.deviceId = '{{DEVICE_ID}}';
bodyAction.deadlineDuration = 'PT5M';
bodyAction.type = 'SAVE_CARD';
bodyAction.saveCardOptions = bodyActionSaveCardOptions;
const body: CreateTerminalActionRequest = {
idempotencyKey: 'thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e',
action: bodyAction,
};
try {
const { result, ...httpResponse } = await terminalApi.createTerminalAction(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.
async searchTerminalActions(
body: SearchTerminalActionsRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<SearchTerminalActionsResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchTerminalActionsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyQueryFilterCreatedAt: TimeRange = {};
bodyQueryFilterCreatedAt.startAt = '2022-04-01T00:00:00Z';
const bodyQueryFilter: TerminalActionQueryFilter = {};
bodyQueryFilter.createdAt = bodyQueryFilterCreatedAt;
const bodyQuerySort: TerminalActionQuerySort = {};
bodyQuerySort.sortOrder = 'DESC';
const bodyQuery: TerminalActionQuery = {};
bodyQuery.filter = bodyQueryFilter;
bodyQuery.sort = bodyQuerySort;
const body: SearchTerminalActionsRequest = {};
body.query = bodyQuery;
body.limit = 2;
try {
const { result, ...httpResponse } = await terminalApi.searchTerminalActions(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves a Terminal action request by action_id
. Terminal action requests are available for 30 days.
async getTerminalAction(
actionId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetTerminalActionResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
actionId |
string |
Template, Required | Unique ID for the desired TerminalAction |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const actionId = 'action_id6';
try {
const { result, ...httpResponse } = await terminalApi.getTerminalAction(actionId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Cancels a Terminal action request if the status of the request permits it.
async cancelTerminalAction(
actionId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<CancelTerminalActionResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
actionId |
string |
Template, Required | Unique ID for the desired TerminalAction |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const actionId = 'action_id6';
try {
const { result, ...httpResponse } = await terminalApi.cancelTerminalAction(actionId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Creates a Terminal checkout request and sends it to the specified device to take a payment for the requested amount.
async createTerminalCheckout(
body: CreateTerminalCheckoutRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CreateTerminalCheckoutResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateTerminalCheckoutRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
CreateTerminalCheckoutResponse
const contentType = null;
const bodyCheckoutAmountMoney: Money = {};
bodyCheckoutAmountMoney.amount = 2610;
bodyCheckoutAmountMoney.currency = 'USD';
const bodyCheckoutDeviceOptions: DeviceCheckoutOptions = {
deviceId: 'dbb5d83a-7838-11ea-bc55-0242ac130003',
};
const bodyCheckout: TerminalCheckout = {
amountMoney: bodyCheckoutAmountMoney,
deviceOptions: bodyCheckoutDeviceOptions,
};
bodyCheckout.referenceId = 'id11572';
bodyCheckout.note = 'A brief note';
const body: CreateTerminalCheckoutRequest = {
idempotencyKey: '28a0c3bc-7839-11ea-bc55-0242ac130003',
checkout: bodyCheckout,
};
try {
const { result, ...httpResponse } = await terminalApi.createTerminalCheckout(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Returns a filtered list of Terminal checkout requests created by the application making the request. Only Terminal checkout requests created for the merchant scoped to the OAuth token are returned. Terminal checkout requests are available for 30 days.
async searchTerminalCheckouts(
body: SearchTerminalCheckoutsRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<SearchTerminalCheckoutsResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchTerminalCheckoutsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
SearchTerminalCheckoutsResponse
const contentType = null;
const bodyQueryFilter: TerminalCheckoutQueryFilter = {};
bodyQueryFilter.status = 'COMPLETED';
const bodyQuery: TerminalCheckoutQuery = {};
bodyQuery.filter = bodyQueryFilter;
const body: SearchTerminalCheckoutsRequest = {};
body.query = bodyQuery;
body.limit = 2;
try {
const { result, ...httpResponse } = await terminalApi.searchTerminalCheckouts(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves a Terminal checkout request by checkout_id
. Terminal checkout requests are available for 30 days.
async getTerminalCheckout(
checkoutId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetTerminalCheckoutResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
checkoutId |
string |
Template, Required | The unique ID for the desired TerminalCheckout . |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const checkoutId = 'checkout_id8';
try {
const { result, ...httpResponse } = await terminalApi.getTerminalCheckout(checkoutId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Cancels a Terminal checkout request if the status of the request permits it.
async cancelTerminalCheckout(
checkoutId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<CancelTerminalCheckoutResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
checkoutId |
string |
Template, Required | The unique ID for the desired TerminalCheckout . |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
CancelTerminalCheckoutResponse
const checkoutId = 'checkout_id8';
try {
const { result, ...httpResponse } = await terminalApi.cancelTerminalCheckout(checkoutId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Creates a request to refund an Interac payment completed on a Square Terminal. Refunds for Interac payments on a Square Terminal are supported only for Interac debit cards in Canada. Other refunds for Terminal payments should use the Refunds API. For more information, see Refunds API.
async createTerminalRefund(
body: CreateTerminalRefundRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<CreateTerminalRefundResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateTerminalRefundRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyRefundAmountMoney: Money = {};
bodyRefundAmountMoney.amount = 111;
bodyRefundAmountMoney.currency = 'CAD';
const bodyRefund: TerminalRefund = {
paymentId: '5O5OvgkcNUhl7JBuINflcjKqUzXZY',
amountMoney: bodyRefundAmountMoney,
reason: 'Returning items',
deviceId: 'f72dfb8e-4d65-4e56-aade-ec3fb8d33291',
};
const body: CreateTerminalRefundRequest = {
idempotencyKey: '402a640b-b26f-401f-b406-46f839590c04',
};
body.refund = bodyRefund;
try {
const { result, ...httpResponse } = await terminalApi.createTerminalRefund(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.
async searchTerminalRefunds(
body: SearchTerminalRefundsRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<SearchTerminalRefundsResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchTerminalRefundsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const contentType = null;
const bodyQueryFilter: TerminalRefundQueryFilter = {};
bodyQueryFilter.status = 'COMPLETED';
const bodyQuery: TerminalRefundQuery = {};
bodyQuery.filter = bodyQueryFilter;
const body: SearchTerminalRefundsRequest = {};
body.query = bodyQuery;
body.limit = 1;
try {
const { result, ...httpResponse } = await terminalApi.searchTerminalRefunds(body);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.
async getTerminalRefund(
terminalRefundId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<GetTerminalRefundResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
terminalRefundId |
string |
Template, Required | The unique ID for the desired TerminalRefund . |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const terminalRefundId = 'terminal_refund_id0';
try {
const { result, ...httpResponse } = await terminalApi.getTerminalRefund(terminalRefundId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}
Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.
async cancelTerminalRefund(
terminalRefundId: string,
requestOptions?: RequestOptions
): Promise<ApiResponse<CancelTerminalRefundResponse>>
Parameter | Type | Tags | Description |
---|---|---|---|
terminalRefundId |
string |
Template, Required | The unique ID for the desired TerminalRefund . |
requestOptions |
RequestOptions | undefined |
Optional | Pass additional request options. |
const terminalRefundId = 'terminal_refund_id0';
try {
const { result, ...httpResponse } = await terminalApi.cancelTerminalRefund(terminalRefundId);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch(error) {
if (error instanceof ApiError) {
const errors = error.result;
// const { statusCode, headers } = error;
}
}