lib/square/api/payments_api.rb
# Cancels (voids) a payment identified by the idempotency key that is
# specified in the
# request.
# Use this method when the status of a `CreatePayment` request is unknown
# (for example, after you send a
# `CreatePayment` request, a network error occurs and you do not get a
# response). In this case, you can
# direct Square to cancel the payment using this endpoint. In the request,
# you provide the same
# idempotency key that you provided in your `CreatePayment` request that you
# want to cancel. After
# canceling the payment, you can submit your `CreatePayment` request again.
# Note that if no payment with the specified idempotency key is found, no
# action is taken and the endpoint
# returns successfully.
# @param [CancelPaymentByIdempotencyKeyRequest] body Required parameter: An
# object containing the fields to POST for the request.  See the
# corresponding object definition for field details.
# @return [CancelPaymentByIdempotencyKeyResponse Hash] response from the API call
Cancels (voids) a payment identified by the idempotency key that is
specified in the
request.
Use this method when the status of a `CreatePayment` request is unknown
(for example, after you send a
`CreatePayment` request, a network error occurs and you do not get a
response). In this case, you can
direct Square to cancel the payment using this endpoint. In the request,
you provide the same
idempotency key that you provided in your `CreatePayment` request that you
want to cancel. After
canceling the payment, you can submit your `CreatePayment` request again.
Note that if no payment with the specified idempotency key is found, no
action is taken and the endpoint
returns successfully.
Cancels ( voids ) a payment identified by the idempotency key that is specified in the request . Use this method when the status of a ` CreatePayment ` request is unknown ( for example after you send a ` CreatePayment ` request a network error occurs and you do not get a response ) . In this case you can direct Square to cancel the payment using this endpoint . In the request you provide the same idempotency key that you provided in your ` CreatePayment ` request that you want to cancel . After canceling the payment you can submit your ` CreatePayment ` request again . Note that if no payment with the specified idempotency key is found no action is taken and the endpoint returns successfully .
def cancel_payment_by_idempotency_key(body:)
      _query_builder = config.get_base_uri
      _query_builder << '/v2/payments/cancel'
      _query_url = APIHelper.clean_url _query_builder
      _headers = {
        'accept' => 'application/json',
        'content-type' => 'application/json; charset=utf-8'
      }
      _request = config.http_client.post(
        _query_url,
        headers: _headers,
        parameters: body.to_json
      )
      OAuth2.apply(config, _request)
      _response = execute_request(_request)
      decoded = APIHelper.json_deserialize(_response.raw_body)
      _errors = APIHelper.map_response(decoded, ['errors'])
      ApiResponse.new(
        _response, data: decoded, errors: _errors
      )
    end
def cancel_payment_by_idempotency_key ( body : ) _query_builder = config . get_base_uri _query_builder << '/v2/payments/cancel' _query_url = APIHelper . clean_url _query_builder _headers = { 'accept' => 'application/json' , 'content-type' => 'application/json; charset=utf-8' } _request = config . http_client . post ( _query_url , headers : _headers , parameters : body . to_json ) OAuth2 . apply ( config , _request ) _response = execute_request ( _request ) decoded = APIHelper . json_deserialize ( _response . raw_body ) _errors = APIHelper . map_response ( decoded , [ 'errors' ] ) ApiResponse . new ( _response , data : decoded , errors : _errors ) end
Cancels (voids) a payment identified by the idempotency key that is
specified in the
request.
Cancels ( voids ) a payment identified by the idempotency key that is specified in the request .
# Prepare query url. # Prepare headers. # Prepare and execute HttpRequest. # Return appropriate response type.
response from the API call
response from the API call
CancelPaymentByIdempotencyKeyResponse Hash
body
<not_specific>
<not_specific>
body Required parameter: An object containing the fields to POST for the request. See the corresponding object definition for field details.
body Required parameter : An object containing the fields to POST for the request . See the corresponding object definition for field details .