|
| 1 | +# connect |
| 2 | + |
| 3 | +## Requirements |
| 4 | + |
| 5 | +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. |
| 6 | + |
| 7 | +## Installation |
| 8 | + |
| 9 | +To install the API client library to your local Maven repository, simply execute: |
| 10 | + |
| 11 | +```shell |
| 12 | +mvn install |
| 13 | +``` |
| 14 | + |
| 15 | +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: |
| 16 | + |
| 17 | +```shell |
| 18 | +mvn deploy |
| 19 | +``` |
| 20 | + |
| 21 | +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. |
| 22 | + |
| 23 | +### Maven users |
| 24 | + |
| 25 | +Add this dependency to your project's POM: |
| 26 | + |
| 27 | +```xml |
| 28 | +<dependency> |
| 29 | + <groupId>com.squareup</groupId> |
| 30 | + <artifactId>connect</artifactId> |
| 31 | + <version>2.0.2</version> |
| 32 | + <scope>compile</scope> |
| 33 | +</dependency> |
| 34 | +``` |
| 35 | + |
| 36 | +### Gradle users |
| 37 | + |
| 38 | +Add this dependency to your project's build file: |
| 39 | + |
| 40 | +```groovy |
| 41 | +compile "com.squareup:connect:2.0.2" |
| 42 | +``` |
| 43 | + |
| 44 | +### Others |
| 45 | + |
| 46 | +At first generate the JAR by executing: |
| 47 | + |
| 48 | + mvn package |
| 49 | + |
| 50 | +Then manually install the following JARs: |
| 51 | + |
| 52 | +* target/connect-2.0.2.jar |
| 53 | +* target/lib/*.jar |
| 54 | + |
| 55 | +## Getting Started |
| 56 | + |
| 57 | +Please follow the [installation](#installation) instruction and execute the following Java code: |
| 58 | + |
| 59 | +```java |
| 60 | + |
| 61 | +import com.squareup.connect.*; |
| 62 | +import com.squareup.connect.auth.*; |
| 63 | +import com.squareup.connect.models.*; |
| 64 | +import com.squareup.connect.api.CheckoutApi; |
| 65 | + |
| 66 | +import java.io.File; |
| 67 | +import java.util.*; |
| 68 | + |
| 69 | +public class CheckoutApiExample { |
| 70 | + |
| 71 | + public static void main(String[] args) { |
| 72 | + |
| 73 | + CheckoutApi apiInstance = new CheckoutApi(); |
| 74 | + String authorization = "authorization_example"; // String | The value to provide in the Authorization header of your request. This value should follow the format `Bearer YOUR_ACCESS_TOKEN_HERE`. |
| 75 | + String locationId = "locationId_example"; // String | The ID of the business location to associate the checkout with. |
| 76 | + CreateCheckoutRequest body = new CreateCheckoutRequest(); // CreateCheckoutRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
| 77 | + try { |
| 78 | + CreateCheckoutResponse result = apiInstance.createCheckout(authorization, locationId, body); |
| 79 | + System.out.println(result); |
| 80 | + } catch (ApiException e) { |
| 81 | + System.err.println("Exception when calling CheckoutApi#createCheckout"); |
| 82 | + e.printStackTrace(); |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +``` |
| 88 | + |
| 89 | +## Documentation for API Endpoints |
| 90 | + |
| 91 | +All URIs are relative to *https://connect.squareup.com* |
| 92 | + |
| 93 | +Class | Method | HTTP request | Description |
| 94 | +------------ | ------------- | ------------- | ------------- |
| 95 | +*CheckoutApi* | [**createCheckout**](docs/CheckoutApi.md#createCheckout) | **POST** /v2/locations/{location_id}/checkouts | CreateCheckout |
| 96 | +*CustomerApi* | [**createCustomer**](docs/CustomerApi.md#createCustomer) | **POST** /v2/customers | CreateCustomer |
| 97 | +*CustomerApi* | [**deleteCustomer**](docs/CustomerApi.md#deleteCustomer) | **DELETE** /v2/customers/{customer_id} | DeleteCustomer |
| 98 | +*CustomerApi* | [**listCustomers**](docs/CustomerApi.md#listCustomers) | **GET** /v2/customers | ListCustomers |
| 99 | +*CustomerApi* | [**retrieveCustomer**](docs/CustomerApi.md#retrieveCustomer) | **GET** /v2/customers/{customer_id} | RetrieveCustomer |
| 100 | +*CustomerApi* | [**updateCustomer**](docs/CustomerApi.md#updateCustomer) | **PUT** /v2/customers/{customer_id} | UpdateCustomer |
| 101 | +*CustomerCardApi* | [**createCustomerCard**](docs/CustomerCardApi.md#createCustomerCard) | **POST** /v2/customers/{customer_id}/cards | CreateCustomerCard |
| 102 | +*CustomerCardApi* | [**deleteCustomerCard**](docs/CustomerCardApi.md#deleteCustomerCard) | **DELETE** /v2/customers/{customer_id}/cards/{card_id} | DeleteCustomerCard |
| 103 | +*LocationApi* | [**listLocations**](docs/LocationApi.md#listLocations) | **GET** /v2/locations | ListLocations |
| 104 | +*RefundApi* | [**createRefund**](docs/RefundApi.md#createRefund) | **POST** /v2/locations/{location_id}/transactions/{transaction_id}/refund | CreateRefund |
| 105 | +*RefundApi* | [**listRefunds**](docs/RefundApi.md#listRefunds) | **GET** /v2/locations/{location_id}/refunds | ListRefunds |
| 106 | +*TransactionApi* | [**captureTransaction**](docs/TransactionApi.md#captureTransaction) | **POST** /v2/locations/{location_id}/transactions/{transaction_id}/capture | CaptureTransaction |
| 107 | +*TransactionApi* | [**charge**](docs/TransactionApi.md#charge) | **POST** /v2/locations/{location_id}/transactions | Charge |
| 108 | +*TransactionApi* | [**listTransactions**](docs/TransactionApi.md#listTransactions) | **GET** /v2/locations/{location_id}/transactions | ListTransactions |
| 109 | +*TransactionApi* | [**retrieveTransaction**](docs/TransactionApi.md#retrieveTransaction) | **GET** /v2/locations/{location_id}/transactions/{transaction_id} | RetrieveTransaction |
| 110 | +*TransactionApi* | [**voidTransaction**](docs/TransactionApi.md#voidTransaction) | **POST** /v2/locations/{location_id}/transactions/{transaction_id}/void | VoidTransaction |
| 111 | + |
| 112 | + |
| 113 | +## Documentation for Models |
| 114 | + |
| 115 | + - [Address](docs/Address.md) |
| 116 | + - [CaptureTransactionRequest](docs/CaptureTransactionRequest.md) |
| 117 | + - [CaptureTransactionResponse](docs/CaptureTransactionResponse.md) |
| 118 | + - [Card](docs/Card.md) |
| 119 | + - [CardBrand](docs/CardBrand.md) |
| 120 | + - [ChargeRequest](docs/ChargeRequest.md) |
| 121 | + - [ChargeResponse](docs/ChargeResponse.md) |
| 122 | + - [Checkout](docs/Checkout.md) |
| 123 | + - [Country](docs/Country.md) |
| 124 | + - [CreateCheckoutRequest](docs/CreateCheckoutRequest.md) |
| 125 | + - [CreateCheckoutResponse](docs/CreateCheckoutResponse.md) |
| 126 | + - [CreateCustomerCardRequest](docs/CreateCustomerCardRequest.md) |
| 127 | + - [CreateCustomerCardResponse](docs/CreateCustomerCardResponse.md) |
| 128 | + - [CreateCustomerRequest](docs/CreateCustomerRequest.md) |
| 129 | + - [CreateCustomerResponse](docs/CreateCustomerResponse.md) |
| 130 | + - [CreateOrderRequest](docs/CreateOrderRequest.md) |
| 131 | + - [CreateOrderRequestLineItem](docs/CreateOrderRequestLineItem.md) |
| 132 | + - [CreateOrderRequestOrder](docs/CreateOrderRequestOrder.md) |
| 133 | + - [CreateRefundRequest](docs/CreateRefundRequest.md) |
| 134 | + - [CreateRefundResponse](docs/CreateRefundResponse.md) |
| 135 | + - [Currency](docs/Currency.md) |
| 136 | + - [Customer](docs/Customer.md) |
| 137 | + - [CustomerGroupInfo](docs/CustomerGroupInfo.md) |
| 138 | + - [CustomerPreferences](docs/CustomerPreferences.md) |
| 139 | + - [DeleteCustomerCardRequest](docs/DeleteCustomerCardRequest.md) |
| 140 | + - [DeleteCustomerCardResponse](docs/DeleteCustomerCardResponse.md) |
| 141 | + - [DeleteCustomerRequest](docs/DeleteCustomerRequest.md) |
| 142 | + - [DeleteCustomerResponse](docs/DeleteCustomerResponse.md) |
| 143 | + - [Error](docs/Error.md) |
| 144 | + - [ErrorCategory](docs/ErrorCategory.md) |
| 145 | + - [ErrorCode](docs/ErrorCode.md) |
| 146 | + - [ListCustomersRequest](docs/ListCustomersRequest.md) |
| 147 | + - [ListCustomersResponse](docs/ListCustomersResponse.md) |
| 148 | + - [ListLocationsRequest](docs/ListLocationsRequest.md) |
| 149 | + - [ListLocationsResponse](docs/ListLocationsResponse.md) |
| 150 | + - [ListRefundsRequest](docs/ListRefundsRequest.md) |
| 151 | + - [ListRefundsResponse](docs/ListRefundsResponse.md) |
| 152 | + - [ListTransactionsRequest](docs/ListTransactionsRequest.md) |
| 153 | + - [ListTransactionsResponse](docs/ListTransactionsResponse.md) |
| 154 | + - [Location](docs/Location.md) |
| 155 | + - [LocationCapability](docs/LocationCapability.md) |
| 156 | + - [Money](docs/Money.md) |
| 157 | + - [Order](docs/Order.md) |
| 158 | + - [OrderLineItem](docs/OrderLineItem.md) |
| 159 | + - [Refund](docs/Refund.md) |
| 160 | + - [RefundStatus](docs/RefundStatus.md) |
| 161 | + - [RetrieveCustomerRequest](docs/RetrieveCustomerRequest.md) |
| 162 | + - [RetrieveCustomerResponse](docs/RetrieveCustomerResponse.md) |
| 163 | + - [RetrieveTransactionRequest](docs/RetrieveTransactionRequest.md) |
| 164 | + - [RetrieveTransactionResponse](docs/RetrieveTransactionResponse.md) |
| 165 | + - [SortOrder](docs/SortOrder.md) |
| 166 | + - [Tender](docs/Tender.md) |
| 167 | + - [TenderCardDetails](docs/TenderCardDetails.md) |
| 168 | + - [TenderCardDetailsEntryMethod](docs/TenderCardDetailsEntryMethod.md) |
| 169 | + - [TenderCardDetailsStatus](docs/TenderCardDetailsStatus.md) |
| 170 | + - [TenderCashDetails](docs/TenderCashDetails.md) |
| 171 | + - [TenderType](docs/TenderType.md) |
| 172 | + - [Transaction](docs/Transaction.md) |
| 173 | + - [TransactionProduct](docs/TransactionProduct.md) |
| 174 | + - [UpdateCustomerRequest](docs/UpdateCustomerRequest.md) |
| 175 | + - [UpdateCustomerResponse](docs/UpdateCustomerResponse.md) |
| 176 | + - [VoidTransactionRequest](docs/VoidTransactionRequest.md) |
| 177 | + - [VoidTransactionResponse](docs/VoidTransactionResponse.md) |
| 178 | + |
| 179 | + |
| 180 | +## Documentation for Authorization |
| 181 | + |
| 182 | +Authentication schemes defined for the API: |
| 183 | +### oauth2 |
| 184 | + |
| 185 | +- **Type**: OAuth |
| 186 | +- **Flow**: accessCode |
| 187 | +- **Authorization URL**: https://connect.squareup.com/oauth2/authorize?<PARAMETERS> |
| 188 | +- **Scopes**: |
| 189 | + - MERCHANT_PROFILE_READ: GET endpoints related to a merchant's business and location entities. Almost all Connect API applications need this permission in order to obtain a merchant's location IDs |
| 190 | + - PAYMENTS_READ: GET endpoints related to transactions and refunds |
| 191 | + - PAYMENTS_WRITE: POST, PUT, and DELETE endpoints related to transactions and refunds. E-commerce applications must request this permission |
| 192 | + - CUSTOMERS_READ: GET endpoints related to customer management |
| 193 | + - CUSTOMERS_WRITE: POST, PUT, and DELETE endpoints related to customer management |
| 194 | + - SETTLEMENTS_READ: GET endpoints related to settlements (deposits) |
| 195 | + - BANK_ACCOUNTS_READ: GET endpoints related to a merchant's bank accounts |
| 196 | + - ITEMS_READ: GET endpoints related to a merchant's item library |
| 197 | + - ITEMS_WRITE: POST, PUT, and DELETE endpoints related to a merchant's item library |
| 198 | + - ORDERS_READ: GET endpoints related to a merchant's Square online store. |
| 199 | + - ORDERS_WRITE: POST, PUT, and DELETE endpoints related to a merchant's Square online store |
| 200 | + - EMPLOYEES_READ: GET endpoints related to employee management |
| 201 | + - EMPLOYEES_WRITE: POST, PUT, and DELETE endpoints related to employee management |
| 202 | + - TIMECARDS_READ: GET endpoints related to employee timecards |
| 203 | + - TIMECARDS_WRITE: POST, PUT, and DELETE endpoints related to employee timecards |
| 204 | + |
| 205 | + |
| 206 | +## Recommendation |
| 207 | + |
| 208 | +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. |
| 209 | + |
| 210 | +## Author |
| 211 | + |
| 212 | + |
| 213 | + |
0 commit comments