lib/square/api/payments_api.rb
# Cancels (voids) a payment. You can use this endpoint to cancel a payment
# with
# the APPROVED `status`.
# @param [String] payment_id Required parameter: The ID of the payment to
# cancel.
# @return [CancelPaymentResponse Hash] response from the API call
Cancels (voids) a payment. You can use this endpoint to cancel a payment
with
the APPROVED `status`.
Cancels ( voids ) a payment . You can use this endpoint to cancel a payment with the APPROVED ` status ` .
def cancel_payment(payment_id:)
      _query_builder = config.get_base_uri
      _query_builder << '/v2/payments/{payment_id}/cancel'
      _query_builder = APIHelper.append_url_with_template_parameters(
        _query_builder,
        'payment_id' => { 'value' => payment_id, 'encode' => true }
      )
      _query_url = APIHelper.clean_url _query_builder
      _headers = {
        'accept' => 'application/json'
      }
      _request = config.http_client.post(
        _query_url,
        headers: _headers
      )
      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 ( payment_id : ) _query_builder = config . get_base_uri _query_builder << '/v2/payments/{payment_id}/cancel' _query_builder = APIHelper . append_url_with_template_parameters ( _query_builder , 'payment_id' => { 'value' => payment_id , 'encode' => true } ) _query_url = APIHelper . clean_url _query_builder _headers = { 'accept' => 'application/json' } _request = config . http_client . post ( _query_url , headers : _headers ) 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.
Cancels ( voids ) 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
CancelPaymentResponse Hash
payment_id
<not_specific>
<not_specific>
payment_id Required parameter: The ID of the payment to cancel.
payment_id Required parameter : The ID of the payment to cancel .