Skip to content

Latest commit

 

History

History
640 lines (477 loc) · 16.2 KB

terminal.md

File metadata and controls

640 lines (477 loc) · 16.2 KB

Terminal

ITerminalApi terminalApi = client.TerminalApi;

Class Name

TerminalApi

Methods

Create Terminal Action

Creates a Terminal action request and sends it to the specified device.

CreateTerminalActionAsync(
    Models.CreateTerminalActionRequest body)

Parameters

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.

Response Type

Task<Models.CreateTerminalActionResponse>

Example Usage

CreateTerminalActionRequest body = new CreateTerminalActionRequest.Builder(
    "thahn-70e75c10-47f7-4ab6-88cc-aaa4076d065e",
    new TerminalAction.Builder()
    .DeviceId("{{DEVICE_ID}}")
    .DeadlineDuration("PT5M")
    .Type("SAVE_CARD")
    .SaveCardOptions(
        new SaveCardOptions.Builder(
            "{{CUSTOMER_ID}}"
        )
        .ReferenceId("user-id-1")
        .Build())
    .Build()
)
.Build();

try
{
    CreateTerminalActionResponse result = await terminalApi.CreateTerminalActionAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Search Terminal Actions

Retrieves a filtered list of Terminal action requests created by the account making the request. Terminal action requests are available for 30 days.

SearchTerminalActionsAsync(
    Models.SearchTerminalActionsRequest body)

Parameters

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.

Response Type

Task<Models.SearchTerminalActionsResponse>

Example Usage

SearchTerminalActionsRequest body = new SearchTerminalActionsRequest.Builder()
.Query(
    new TerminalActionQuery.Builder()
    .Filter(
        new TerminalActionQueryFilter.Builder()
        .CreatedAt(
            new TimeRange.Builder()
            .StartAt("2022-04-01T00:00:00.000Z")
            .Build())
        .Build())
    .Sort(
        new TerminalActionQuerySort.Builder()
        .SortOrder("DESC")
        .Build())
    .Build())
.Limit(2)
.Build();

try
{
    SearchTerminalActionsResponse result = await terminalApi.SearchTerminalActionsAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Get Terminal Action

Retrieves a Terminal action request by action_id. Terminal action requests are available for 30 days.

GetTerminalActionAsync(
    string actionId)

Parameters

Parameter Type Tags Description
actionId string Template, Required Unique ID for the desired TerminalAction.

Response Type

Task<Models.GetTerminalActionResponse>

Example Usage

string actionId = "action_id6";
try
{
    GetTerminalActionResponse result = await terminalApi.GetTerminalActionAsync(actionId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Cancel Terminal Action

Cancels a Terminal action request if the status of the request permits it.

CancelTerminalActionAsync(
    string actionId)

Parameters

Parameter Type Tags Description
actionId string Template, Required Unique ID for the desired TerminalAction.

Response Type

Task<Models.CancelTerminalActionResponse>

Example Usage

string actionId = "action_id6";
try
{
    CancelTerminalActionResponse result = await terminalApi.CancelTerminalActionAsync(actionId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Dismiss Terminal Action

Dismisses a Terminal action request if the status and type of the request permits it.

See Link and Dismiss Actions for more details.

DismissTerminalActionAsync(
    string actionId)

Parameters

Parameter Type Tags Description
actionId string Template, Required Unique ID for the TerminalAction associated with the action to be dismissed.

Response Type

Task<Models.DismissTerminalActionResponse>

Example Usage

string actionId = "action_id6";
try
{
    DismissTerminalActionResponse result = await terminalApi.DismissTerminalActionAsync(actionId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Create Terminal Checkout

Creates a Terminal checkout request and sends it to the specified device to take a payment for the requested amount.

CreateTerminalCheckoutAsync(
    Models.CreateTerminalCheckoutRequest body)

Parameters

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.

Response Type

Task<Models.CreateTerminalCheckoutResponse>

Example Usage

CreateTerminalCheckoutRequest body = new CreateTerminalCheckoutRequest.Builder(
    "28a0c3bc-7839-11ea-bc55-0242ac130003",
    new TerminalCheckout.Builder(
        new Money.Builder()
        .Amount(2610L)
        .Currency("USD")
        .Build(),
        new DeviceCheckoutOptions.Builder(
            "dbb5d83a-7838-11ea-bc55-0242ac130003"
        )
        .Build()
    )
    .ReferenceId("id11572")
    .Note("A brief note")
    .Build()
)
.Build();

try
{
    CreateTerminalCheckoutResponse result = await terminalApi.CreateTerminalCheckoutAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Search Terminal Checkouts

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.

SearchTerminalCheckoutsAsync(
    Models.SearchTerminalCheckoutsRequest body)

Parameters

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.

Response Type

Task<Models.SearchTerminalCheckoutsResponse>

Example Usage

SearchTerminalCheckoutsRequest body = new SearchTerminalCheckoutsRequest.Builder()
.Query(
    new TerminalCheckoutQuery.Builder()
    .Filter(
        new TerminalCheckoutQueryFilter.Builder()
        .Status("COMPLETED")
        .Build())
    .Build())
.Limit(2)
.Build();

try
{
    SearchTerminalCheckoutsResponse result = await terminalApi.SearchTerminalCheckoutsAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Get Terminal Checkout

Retrieves a Terminal checkout request by checkout_id. Terminal checkout requests are available for 30 days.

GetTerminalCheckoutAsync(
    string checkoutId)

Parameters

Parameter Type Tags Description
checkoutId string Template, Required The unique ID for the desired TerminalCheckout.

Response Type

Task<Models.GetTerminalCheckoutResponse>

Example Usage

string checkoutId = "checkout_id8";
try
{
    GetTerminalCheckoutResponse result = await terminalApi.GetTerminalCheckoutAsync(checkoutId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Cancel Terminal Checkout

Cancels a Terminal checkout request if the status of the request permits it.

CancelTerminalCheckoutAsync(
    string checkoutId)

Parameters

Parameter Type Tags Description
checkoutId string Template, Required The unique ID for the desired TerminalCheckout.

Response Type

Task<Models.CancelTerminalCheckoutResponse>

Example Usage

string checkoutId = "checkout_id8";
try
{
    CancelTerminalCheckoutResponse result = await terminalApi.CancelTerminalCheckoutAsync(checkoutId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Dismiss Terminal Checkout

Dismisses a Terminal checkout request if the status and type of the request permits it.

DismissTerminalCheckoutAsync(
    string checkoutId)

Parameters

Parameter Type Tags Description
checkoutId string Template, Required Unique ID for the TerminalCheckout associated with the checkout to be dismissed.

Response Type

Task<Models.DismissTerminalCheckoutResponse>

Example Usage

string checkoutId = "checkout_id8";
try
{
    DismissTerminalCheckoutResponse result = await terminalApi.DismissTerminalCheckoutAsync(checkoutId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Create Terminal Refund

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.

CreateTerminalRefundAsync(
    Models.CreateTerminalRefundRequest body)

Parameters

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.

Response Type

Task<Models.CreateTerminalRefundResponse>

Example Usage

CreateTerminalRefundRequest body = new CreateTerminalRefundRequest.Builder(
    "402a640b-b26f-401f-b406-46f839590c04"
)
.Refund(
    new TerminalRefund.Builder(
        "5O5OvgkcNUhl7JBuINflcjKqUzXZY",
        new Money.Builder()
        .Amount(111L)
        .Currency("CAD")
        .Build(),
        "Returning items",
        "f72dfb8e-4d65-4e56-aade-ec3fb8d33291"
    )
    .Build())
.Build();

try
{
    CreateTerminalRefundResponse result = await terminalApi.CreateTerminalRefundAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Search Terminal Refunds

Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request. Terminal refund requests are available for 30 days.

SearchTerminalRefundsAsync(
    Models.SearchTerminalRefundsRequest body)

Parameters

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.

Response Type

Task<Models.SearchTerminalRefundsResponse>

Example Usage

SearchTerminalRefundsRequest body = new SearchTerminalRefundsRequest.Builder()
.Query(
    new TerminalRefundQuery.Builder()
    .Filter(
        new TerminalRefundQueryFilter.Builder()
        .Status("COMPLETED")
        .Build())
    .Build())
.Limit(1)
.Build();

try
{
    SearchTerminalRefundsResponse result = await terminalApi.SearchTerminalRefundsAsync(body);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Get Terminal Refund

Retrieves an Interac Terminal refund object by ID. Terminal refund objects are available for 30 days.

GetTerminalRefundAsync(
    string terminalRefundId)

Parameters

Parameter Type Tags Description
terminalRefundId string Template, Required The unique ID for the desired TerminalRefund.

Response Type

Task<Models.GetTerminalRefundResponse>

Example Usage

string terminalRefundId = "terminal_refund_id0";
try
{
    GetTerminalRefundResponse result = await terminalApi.GetTerminalRefundAsync(terminalRefundId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Cancel Terminal Refund

Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.

CancelTerminalRefundAsync(
    string terminalRefundId)

Parameters

Parameter Type Tags Description
terminalRefundId string Template, Required The unique ID for the desired TerminalRefund.

Response Type

Task<Models.CancelTerminalRefundResponse>

Example Usage

string terminalRefundId = "terminal_refund_id0";
try
{
    CancelTerminalRefundResponse result = await terminalApi.CancelTerminalRefundAsync(terminalRefundId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}

Dismiss Terminal Refund

Dismisses a Terminal refund request if the status and type of the request permits it.

DismissTerminalRefundAsync(
    string terminalRefundId)

Parameters

Parameter Type Tags Description
terminalRefundId string Template, Required Unique ID for the TerminalRefund associated with the refund to be dismissed.

Response Type

Task<Models.DismissTerminalRefundResponse>

Example Usage

string terminalRefundId = "terminal_refund_id0";
try
{
    DismissTerminalRefundResponse result = await terminalApi.DismissTerminalRefundAsync(terminalRefundId);
}
catch (ApiException e)
{
    // TODO: Handle exception here
    Console.WriteLine(e.Message);
}