All URIs are relative to https://connect.squareup.com
Method | HTTP request | Description |
---|---|---|
captureTransaction | POST /v2/locations/{location_id}/transactions/{transaction_id}/capture | CaptureTransaction |
charge | POST /v2/locations/{location_id}/transactions | Charge |
createRefund | POST /v2/locations/{location_id}/transactions/{transaction_id}/refund | CreateRefund |
listRefunds | GET /v2/locations/{location_id}/refunds | ListRefunds |
listTransactions | GET /v2/locations/{location_id}/transactions | ListTransactions |
retrieveTransaction | GET /v2/locations/{location_id}/transactions/{transaction_id} | RetrieveTransaction |
voidTransaction | POST /v2/locations/{location_id}/transactions/{transaction_id}/void | VoidTransaction |
Note: This endpoint is deprecated.
CaptureTransactionResponse captureTransaction(locationId, transactionId)
CaptureTransaction
Captures a transaction that was created with the Charge endpoint with a `delay_capture` value of `true`. See Delayed capture transactions for more information.
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.TransactionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
TransactionsApi apiInstance = new TransactionsApi();
String locationId = "locationId_example"; // String |
String transactionId = "transactionId_example"; // String |
try {
CaptureTransactionResponse result = apiInstance.captureTransaction(locationId, transactionId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#captureTransaction");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | String | ||
transactionId | String |
- Content-Type: application/json
- Accept: application/json
Note: This endpoint is deprecated.
ChargeResponse charge(locationId, body)
Charge
Charges a card represented by a card nonce or a customer's card on file. Deprecated - recommend using CreatePayment Your request to this endpoint must include either: - A value for the `card_nonce` parameter (to charge a card nonce generated with the `SqPaymentForm`) - Values for the `customer_card_id` and `customer_id` parameters (to charge a customer's card on file) In order for an eCommerce payment to potentially qualify for Square chargeback protection, you must provide values for the following parameters in your request: - `buyer_email_address` - At least one of `billing_address` or `shipping_address` When this response is returned, the amount of Square's processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call RetrieveTransaction. See the `processing_fee_money` field of each Tender included in the transaction.
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.TransactionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
TransactionsApi apiInstance = new TransactionsApi();
String locationId = "locationId_example"; // String | The ID of the location to associate the created transaction with.
ChargeRequest body = new ChargeRequest(); // ChargeRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try {
ChargeResponse result = apiInstance.charge(locationId, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#charge");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | String | The ID of the location to associate the created transaction with. | |
body | ChargeRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
Note: This endpoint is deprecated.
CreateRefundResponse createRefund(locationId, transactionId, body)
CreateRefund
Initiates a refund for a previously charged tender. Deprecated - recommend using RefundPayment You must issue a refund within 120 days of the associated payment. See this article for more information on refund behavior. NOTE: Card-present transactions with Interac credit cards cannot be refunded using the Connect API. Interac transactions must refunded in-person (e.g., dipping the card using POS app).
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.TransactionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
TransactionsApi apiInstance = new TransactionsApi();
String locationId = "locationId_example"; // String | The ID of the original transaction's associated location.
String transactionId = "transactionId_example"; // String | The ID of the original transaction that includes the tender to refund.
CreateRefundRequest body = new CreateRefundRequest(); // CreateRefundRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details.
try {
CreateRefundResponse result = apiInstance.createRefund(locationId, transactionId, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#createRefund");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | String | The ID of the original transaction's associated location. | |
transactionId | String | The ID of the original transaction that includes the tender to refund. | |
body | CreateRefundRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
- Content-Type: application/json
- Accept: application/json
Note: This endpoint is deprecated.
ListRefundsResponse listRefunds(locationId, beginTime, endTime, sortOrder, cursor)
ListRefunds
Lists refunds for one of a business's locations. Deprecated - recommend using SearchOrders In addition to full or partial tender refunds processed through Square APIs, refunds may result from itemized returns or exchanges through Square's Point of Sale applications. Refunds with a `status` of `PENDING` are not currently included in this endpoint's response. Max results per page: 50
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.TransactionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
TransactionsApi apiInstance = new TransactionsApi();
String locationId = "locationId_example"; // String | The ID of the location to list refunds for.
String beginTime = "beginTime_example"; // String | The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
String endTime = "endTime_example"; // String | The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
String sortOrder = "sortOrder_example"; // String | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC`
String cursor = "cursor_example"; // String | 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](#paginatingresults) for more information.
try {
ListRefundsResponse result = apiInstance.listRefunds(locationId, beginTime, endTime, sortOrder, cursor);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#listRefunds");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | String | The ID of the location to list refunds for. | |
beginTime | String | 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. | [optional] |
endTime | String | 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. | [optional] |
sortOrder | String | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` | [optional] |
cursor | String | 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. | [optional] |
- Content-Type: application/json
- Accept: application/json
Note: This endpoint is deprecated.
ListTransactionsResponse listTransactions(locationId, beginTime, endTime, sortOrder, cursor)
ListTransactions
Lists transactions for a particular location. Deprecated - recommend using SearchOrders Transactions include payment information from sales and exchanges and refund information from returns and exchanges. Max results per page: 50
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.TransactionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
TransactionsApi apiInstance = new TransactionsApi();
String locationId = "locationId_example"; // String | The ID of the location to list transactions for.
String beginTime = "beginTime_example"; // String | The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year.
String endTime = "endTime_example"; // String | The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time.
String sortOrder = "sortOrder_example"; // String | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC`
String cursor = "cursor_example"; // String | 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](#paginatingresults) for more information.
try {
ListTransactionsResponse result = apiInstance.listTransactions(locationId, beginTime, endTime, sortOrder, cursor);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#listTransactions");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | String | The ID of the location to list transactions for. | |
beginTime | String | 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. | [optional] |
endTime | String | 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. | [optional] |
sortOrder | String | The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` | [optional] |
cursor | String | 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. | [optional] |
- Content-Type: application/json
- Accept: application/json
Note: This endpoint is deprecated.
RetrieveTransactionResponse retrieveTransaction(locationId, transactionId)
RetrieveTransaction
Retrieves details for a single transaction. Deprecated - recommend using BatchRetrieveOrders
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.TransactionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
TransactionsApi apiInstance = new TransactionsApi();
String locationId = "locationId_example"; // String | The ID of the transaction's associated location.
String transactionId = "transactionId_example"; // String | The ID of the transaction to retrieve.
try {
RetrieveTransactionResponse result = apiInstance.retrieveTransaction(locationId, transactionId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#retrieveTransaction");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | String | The ID of the transaction's associated location. | |
transactionId | String | The ID of the transaction to retrieve. |
- Content-Type: application/json
- Accept: application/json
Note: This endpoint is deprecated.
VoidTransactionResponse voidTransaction(locationId, transactionId)
VoidTransaction
Cancels a transaction that was created with the Charge endpoint with a `delay_capture` value of `true`. See Delayed capture transactions for more information.
// Import classes:
//import com.squareup.connect.ApiClient;
//import com.squareup.connect.ApiException;
//import com.squareup.connect.Configuration;
//import com.squareup.connect.auth.*;
//import com.squareup.connect.api.TransactionsApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure OAuth2 access token for authorization: oauth2
OAuth oauth2 = (OAuth) defaultClient.getAuthentication("oauth2");
oauth2.setAccessToken("YOUR ACCESS TOKEN");
TransactionsApi apiInstance = new TransactionsApi();
String locationId = "locationId_example"; // String |
String transactionId = "transactionId_example"; // String |
try {
VoidTransactionResponse result = apiInstance.voidTransaction(locationId, transactionId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling TransactionsApi#voidTransaction");
e.printStackTrace();
}
Name | Type | Description | Notes |
---|---|---|---|
locationId | String | ||
transactionId | String |
- Content-Type: application/json
- Accept: application/json