Class: Square::V1TransactionsApi

Inherits:
BaseApi
  • Object
show all
Defined in:
lib/square/api/v1_transactions_api.rb

Overview

V1TransactionsApi

Instance Attribute Summary

Attributes inherited from BaseApi

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseApi

#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from Square::BaseApi

Instance Method Details

#v1_create_refund(location_id:, body:) ⇒ V1Refund Hash

Issues a refund for a previously processed payment. You must issue a refund within 60 days of the associated payment. You cannot issue a partial refund for a split tender payment. You must instead issue a full or partial refund for a particular tender, by providing the applicable tender id to the V1CreateRefund endpoint. Issuing a full refund for a split tender payment refunds all tenders associated with the payment. Issuing a refund for a card payment is not reversible. For development purposes, you can create fake cash payments in Square Point of Sale and refund them. payment’s associated location. containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • location_id (String)

    Required parameter: The ID of the original

  • body (V1CreateRefundRequest)

    Required parameter: An object

Returns:

  • (V1Refund Hash)

    response from the API call



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/square/api/v1_transactions_api.rb', line 261

def v1_create_refund(location_id:,
                     body:)
  warn 'Endpoint v1_create_refund in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/v1/{location_id}/refunds',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#v1_list_orders(location_id:, order: nil, limit: nil, batch_token: nil) ⇒ List of V1Order Hash

Provides summary information for a merchant’s online store orders. list online store orders for. are listed in the response. to return in a single response. This value cannot exceed 200. retrieve the next set of results for your original query to the endpoint.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which payments

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of payments

  • batch_token (String) (defaults to: nil)

    Optional parameter: A pagination cursor to

Returns:

  • (List of V1Order Hash)

    response from the API call



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/square/api/v1_transactions_api.rb', line 15

def v1_list_orders(location_id:,
                   order: nil,
                   limit: nil,
                   batch_token: nil)
  warn 'Endpoint v1_list_orders in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/orders',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .query_param(new_parameter(order, key: 'order'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(batch_token, key: 'batch_token'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create))
               .is_response_array(true))
    .execute
end

#v1_list_payments(location_id:, order: nil, begin_time: nil, end_time: nil, limit: nil, batch_token: nil, include_partial: false) ⇒ List of V1Payment Hash

Provides summary information for all payments taken for a given Square account during a date range. Date ranges cannot exceed 1 year in length. See Date ranges for details of inclusive and exclusive dates. Note*: Details for payments processed with Square Point of Sale while in offline mode may not be transmitted to Square for up to 72 hours. Offline payments have a ‘created_at` value that reflects the time the payment was originally processed, not the time it was subsequently transmitted to Square. Consequently, the ListPayments endpoint might list an offline payment chronologically between online payments that were seen in a previous request. list payments for. If you specify me, this endpoint returns payments aggregated from all of the business’s locations. are listed in the response. requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. to return in a single response. This value cannot exceed 200. retrieve the next set of results for your original query to the endpoint. Indicates whether or not to include partial payments in the response. Partial payments will have the tenders collected so far, but the itemizations will be empty until the payment is completed.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which payments

  • begin_time (String) (defaults to: nil)

    Optional parameter: The beginning of the

  • end_time (String) (defaults to: nil)

    Optional parameter: The end of the requested

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of payments

  • batch_token (String) (defaults to: nil)

    Optional parameter: A pagination cursor to

  • include_partial (TrueClass|FalseClass) (defaults to: false)

    Optional parameter:

Returns:

  • (List of V1Payment Hash)

    response from the API call



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/square/api/v1_transactions_api.rb', line 135

def v1_list_payments(location_id:,
                     order: nil,
                     begin_time: nil,
                     end_time: nil,
                     limit: nil,
                     batch_token: nil,
                     include_partial: false)
  warn 'Endpoint v1_list_payments in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/payments',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .query_param(new_parameter(order, key: 'order'))
               .query_param(new_parameter(begin_time, key: 'begin_time'))
               .query_param(new_parameter(end_time, key: 'end_time'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(batch_token, key: 'batch_token'))
               .query_param(new_parameter(include_partial, key: 'include_partial'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create))
               .is_response_array(true))
    .execute
end

#v1_list_refunds(location_id:, order: nil, begin_time: nil, end_time: nil, limit: nil, batch_token: nil) ⇒ List of V1Refund Hash

Provides the details for all refunds initiated by a merchant or any of the merchant’s mobile staff during a date range. Date ranges cannot exceed one year in length. list refunds for. are listed in the response. requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. refunds to return in a single response. Default: 100. Max: 200. Response may contain more results than the prescribed limit when refunds are made simultaneously to multiple tenders in a payment or when refunds are generated in an exchange to account for the value of returned goods. retrieve the next set of results for your original query to the endpoint.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which payments

  • begin_time (String) (defaults to: nil)

    Optional parameter: The beginning of the

  • end_time (String) (defaults to: nil)

    Optional parameter: The end of the requested

  • limit (Integer) (defaults to: nil)

    Optional parameter: The approximate number of

  • batch_token (String) (defaults to: nil)

    Optional parameter: A pagination cursor to

Returns:

  • (List of V1Refund Hash)

    response from the API call



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/square/api/v1_transactions_api.rb', line 217

def v1_list_refunds(location_id:,
                    order: nil,
                    begin_time: nil,
                    end_time: nil,
                    limit: nil,
                    batch_token: nil)
  warn 'Endpoint v1_list_refunds in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/refunds',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .query_param(new_parameter(order, key: 'order'))
               .query_param(new_parameter(begin_time, key: 'begin_time'))
               .query_param(new_parameter(end_time, key: 'end_time'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(batch_token, key: 'batch_token'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create))
               .is_response_array(true))
    .execute
end

#v1_list_settlements(location_id:, order: nil, begin_time: nil, end_time: nil, limit: nil, status: nil, batch_token: nil) ⇒ List of V1Settlement Hash

Provides summary information for all deposits and withdrawals initiated by Square to a linked bank account during a date range. Date ranges cannot exceed one year in length. Note*: the ListSettlements endpoint does not provide entry information. list settlements for. If you specify me, this endpoint returns settlements aggregated from all of the business’s locations. settlements are listed in the response. requested reporting period, in ISO 8601 format. If this value is before January 1, 2013 (2013-01-01T00:00:00Z), this endpoint returns an error. Default value: The current time minus one year. reporting period, in ISO 8601 format. If this value is more than one year greater than begin_time, this endpoint returns an error. Default value: The current time. settlements to return in a single response. This value cannot exceed 200. this parameter to retrieve only settlements with a particular status (SENT or FAILED). retrieve the next set of results for your original query to the endpoint.

Parameters:

  • location_id (String)

    Required parameter: The ID of the location to

  • order (SortOrder) (defaults to: nil)

    Optional parameter: The order in which

  • begin_time (String) (defaults to: nil)

    Optional parameter: The beginning of the

  • end_time (String) (defaults to: nil)

    Optional parameter: The end of the requested

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of

  • status (V1ListSettlementsRequestStatus) (defaults to: nil)

    Optional parameter: Provide

  • batch_token (String) (defaults to: nil)

    Optional parameter: A pagination cursor to

Returns:

  • (List of V1Settlement Hash)

    response from the API call



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/square/api/v1_transactions_api.rb', line 310

def v1_list_settlements(location_id:,
                        order: nil,
                        begin_time: nil,
                        end_time: nil,
                        limit: nil,
                        status: nil,
                        batch_token: nil)
  warn 'Endpoint v1_list_settlements in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/settlements',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .query_param(new_parameter(order, key: 'order'))
               .query_param(new_parameter(begin_time, key: 'begin_time'))
               .query_param(new_parameter(end_time, key: 'end_time'))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(status, key: 'status'))
               .query_param(new_parameter(batch_token, key: 'batch_token'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create))
               .is_response_array(true))
    .execute
end

#v1_retrieve_order(location_id:, order_id:) ⇒ V1Order Hash

Provides comprehensive information for a single online store order, including the order’s history. associated location. You obtain this value from Order objects returned by the List Orders endpoint

Parameters:

  • location_id (String)

    Required parameter: The ID of the order’s

  • order_id (String)

    Required parameter: The order’s Square-issued ID.

Returns:

  • (V1Order Hash)

    response from the API call



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/square/api/v1_transactions_api.rb', line 47

def v1_retrieve_order(location_id:,
                      order_id:)
  warn 'Endpoint v1_retrieve_order in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/orders/{order_id}',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .template_param(new_parameter(order_id, key: 'order_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#v1_retrieve_payment(location_id:, payment_id:) ⇒ V1Payment Hash

Provides comprehensive information for a single payment. associated location. ID. payment_id comes from Payment objects returned by the List Payments endpoint, Settlement objects returned by the List Settlements endpoint, or Refund objects returned by the List Refunds endpoint.

Parameters:

  • location_id (String)

    Required parameter: The ID of the payment’s

  • payment_id (String)

    Required parameter: The Square-issued payment

Returns:

  • (V1Payment Hash)

    response from the API call



173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/square/api/v1_transactions_api.rb', line 173

def v1_retrieve_payment(location_id:,
                        payment_id:)
  warn 'Endpoint v1_retrieve_payment in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/payments/{payment_id}',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .template_param(new_parameter(payment_id, key: 'payment_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#v1_retrieve_settlement(location_id:, settlement_id:) ⇒ V1Settlement Hash

Provides comprehensive information for a single settlement. The returned ‘Settlement` objects include an `entries` field that lists the transactions that contribute to the settlement total. Most settlement entries correspond to a payment payout, but settlement entries are also generated for less common events, like refunds, manual adjustments, or chargeback holds. Square initiates its regular deposits as indicated in the [Deposit Options with Square](squareup.com/help/us/en/article/3807) help article. Details for a regular deposit are usually not available from Connect API endpoints before 10 p.m. PST the same day. Square does not know when an initiated settlement completes, only whether it has failed. A completed settlement is typically reflected in a bank account within 3 business days, but in exceptional cases it may take longer. settlements’s associated location. Square-issued ID. You obtain this value from Settlement objects returned by the List Settlements endpoint.

Parameters:

  • location_id (String)

    Required parameter: The ID of the

  • settlement_id (String)

    Required parameter: The settlement’s

Returns:

  • (V1Settlement Hash)

    response from the API call



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/square/api/v1_transactions_api.rb', line 361

def v1_retrieve_settlement(location_id:,
                           settlement_id:)
  warn 'Endpoint v1_retrieve_settlement in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/v1/{location_id}/settlements/{settlement_id}',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .template_param(new_parameter(settlement_id, key: 'settlement_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end

#v1_update_order(location_id:, order_id:, body:) ⇒ V1Order Hash

Updates the details of an online store order. Every update you perform on an order corresponds to one of three actions: associated location. You obtain this value from Order objects returned by the List Orders endpoint containing the fields to POST for the request. See the corresponding object definition for field details.

Parameters:

  • location_id (String)

    Required parameter: The ID of the order’s

  • order_id (String)

    Required parameter: The order’s Square-issued ID.

  • body (V1UpdateOrderRequest)

    Required parameter: An object

Returns:

  • (V1Order Hash)

    response from the API call



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/square/api/v1_transactions_api.rb', line 78

def v1_update_order(location_id:,
                    order_id:,
                    body:)
  warn 'Endpoint v1_update_order in V1TransactionsApi is deprecated'
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/v1/{location_id}/orders/{order_id}',
                                 'default')
               .template_param(new_parameter(location_id, key: 'location_id')
                                .should_encode(true))
               .template_param(new_parameter(order_id, key: 'order_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('global')))
    .response(new_response_handler
               .deserializer(APIHelper.method(:json_deserialize))
               .is_api_response(true)
               .convertor(ApiResponse.method(:create)))
    .execute
end