lib/square/api/refunds_api.rb
def refund_payment(body:)
      # Prepare query url.
      _query_builder = config.get_base_uri
      _query_builder << '/v2/refunds'
      _query_url = APIHelper.clean_url _query_builder

      # Prepare headers.
      _headers = {
        'accept' => 'application/json',
        'Content-Type' => 'application/json'
      }

      # Prepare and execute HttpRequest.
      _request = config.http_client.post(
        _query_url,
        headers: _headers,
        parameters: body.to_json
      )
      OAuth2.apply(config, _request)
      _response = execute_request(_request)

      # Return appropriate response type.
      decoded = APIHelper.json_deserialize(_response.raw_body)
      _errors = APIHelper.map_response(decoded, ['errors'])
      ApiResponse.new(
        _response, data: decoded, errors: _errors
      )
    end
# Refunds a payment. You can refund the entire payment amount or a
# portion of it. You can use this endpoint to refund a card payment or
# record a
# refund of a cash or external payment. For more information, see
# [Refund
# Payment](https://developer.squareup.com/docs/payments-api/refund-payments)
# .
# @param [RefundPaymentRequest] body Required parameter: An object
# containing the fields to POST for the request.  See the corresponding
# object definition for field details.
# @return [RefundPaymentResponse Hash] response from the API call
Refunds a payment. You can refund the entire payment amount or a
portion of it. You can use this endpoint to refund a card payment or
record a
refund of a cash or external payment. For more information, see
[Refund
Payment]
.
Refunds a payment . You can refund the entire payment amount or a portion of it . You can use this endpoint to refund a card payment or record a refund of a cash or external payment . For more information see [ Refund Payment ] .
def refund_payment(body:)
      _query_builder = config.get_base_uri
      _query_builder << '/v2/refunds'
      _query_url = APIHelper.clean_url _query_builder
      _headers = {
        'accept' => 'application/json',
        'Content-Type' => 'application/json'
      }
      _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 refund_payment ( body : ) _query_builder = config . get_base_uri _query_builder << '/v2/refunds' _query_url = APIHelper . clean_url _query_builder _headers = { 'accept' => 'application/json' , 'Content-Type' => 'application/json' } _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
Refunds a payment.
Refunds a payment .
# Prepare query url. # Prepare headers. # Prepare and execute HttpRequest. # Return appropriate response type.
response from the API call
response from the API call
RefundPaymentResponse Hash
body
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 .