lib/square/api/payments_api.rb
# Charges a payment source (for example, a card
# represented by customer's card on file or a card nonce). In addition
# to the payment source, the request must include the
# amount to accept for the payment.
# There are several optional parameters that you can include in the request
# (for example, tip money, whether to autocomplete the payment, or a
# reference ID
# to correlate this payment with another system).
# The `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required
# to enable application fees.
# @param [CreatePaymentRequest] body Required parameter: An object
# containing the fields to POST for the request.  See the corresponding
# object definition for field details.
# @return [CreatePaymentResponse Hash] response from the API call
Charges a payment source (for example, a card
represented by customer's card on file or a card nonce). In addition
to the payment source, the request must include the
amount to accept for the payment.
There are several optional parameters that you can include in the request
(for example, tip money, whether to autocomplete the payment, or a
reference ID
to correlate this payment with another system).
The `PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS` OAuth permission is required
to enable application fees.
Charges a payment source ( for example a card represented by customer ' s card on file or a card nonce ) . In addition to the payment source the request must include the amount to accept for the payment . There are several optional parameters that you can include in the request ( for example tip money whether to autocomplete the payment or a reference ID to correlate this payment with another system ) . The ` PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS ` OAuth permission is required to enable application fees .
def create_payment(body:)
      _query_builder = config.get_base_uri
      _query_builder << '/v2/payments'
      _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 create_payment ( body : ) _query_builder = config . get_base_uri _query_builder << '/v2/payments' _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
Charges a payment source (for example, a card
represented by customer's card on file or a card nonce).
Charges a payment source ( for example a card represented by customer ' s card on file or a card nonce ) .
# Prepare query url. # Prepare headers. # Prepare and execute HttpRequest. # Return appropriate response type.
response from the API call
response from the API call
CreatePaymentResponse 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 .