lib/square/api/customers_api.rb
# Adds a card on file to an existing customer.
# As with charges, calls to `CreateCustomerCard` are idempotent. Multiple
# calls with the same card nonce return the same card record that was
# created
# with the provided nonce during the _first_ call.
# @param [String] customer_id Required parameter: The Square ID of the
# customer profile the card is linked to.
# @param [CreateCustomerCardRequest] body Required parameter: An object
# containing the fields to POST for the request.  See the corresponding
# object definition for field details.
# @return [CreateCustomerCardResponse Hash] response from the API call
Adds a card on file to an existing customer.
As with charges, calls to `CreateCustomerCard` are idempotent. Multiple
calls with the same card nonce return the same card record that was
created
with the provided nonce during the _first_ call.
Adds a card on file to an existing customer . As with charges calls to ` CreateCustomerCard ` are idempotent . Multiple calls with the same card nonce return the same card record that was created with the provided nonce during the _first_ call .
def create_customer_card(customer_id:,
                             body:)
      warn 'Endpoint create_customer_card in CustomersApi is deprecated'
      _query_builder = config.get_base_uri
      _query_builder << '/v2/customers/{customer_id}/cards'
      _query_builder = APIHelper.append_url_with_template_parameters(
        _query_builder,
        'customer_id' => { 'value' => customer_id, 'encode' => true }
      )
      _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_customer_card ( customer_id : , body : ) warn 'Endpoint create_customer_card in CustomersApi is deprecated' _query_builder = config . get_base_uri _query_builder << '/v2/customers/{customer_id}/cards' _query_builder = APIHelper . append_url_with_template_parameters ( _query_builder , 'customer_id' => { 'value' => customer_id , 'encode' => true } ) _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
Adds a card on file to an existing customer.
Adds a card on file to an existing customer .
# Prepare query url. # Prepare headers. # Prepare and execute HttpRequest. # Return appropriate response type.
response from the API call
response from the API call
CreateCustomerCardResponse Hash
customer_id
<not_specific>
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 .