src/main/java/com/squareup/connect/api/TransactionsApi.java
@Deprecated
  public ChargeResponse charge(String locationId, ChargeRequest body) throws ApiException {
    Object localVarPostBody = body;
    
    // verify the required parameter 'locationId' is set
    if (locationId == null) {
      throw new ApiException(400, "Missing the required parameter 'locationId' when calling charge");
    }
    
    // verify the required parameter 'body' is set
    if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling charge");
    }
    
    // create path and map variables
    String localVarPath = "/v2/locations/{location_id}/transactions"
      .replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));

    // query params
    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    Map<String, String> localVarHeaderParams = new HashMap<String, String>();
    Map<String, Object> localVarFormParams = new HashMap<String, Object>();
    localVarHeaderParams.put("Square-Version", "2019-11-20");

    
    
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "oauth2" };

    GenericType<ChargeResponse> localVarReturnType = new GenericType<ChargeResponse>() {};
    CompleteResponse<ChargeResponse> completeResponse = (CompleteResponse<ChargeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    return completeResponse.getData();
      }
/**
   * Charge
   * Charges a card represented by a card nonce or a customer&#39;s card on file.  Deprecated - recommend using [CreatePayment](#endpoint-payments-createpayment)  Your request to this endpoint must include _either_:  - A value for the &#x60;card_nonce&#x60; parameter (to charge a card nonce generated with the &#x60;SqPaymentForm&#x60;) - Values for the &#x60;customer_card_id&#x60; and &#x60;customer_id&#x60; parameters (to charge a customer&#39;s card on file)  In order for an eCommerce payment to potentially qualify for [Square chargeback protection](https://squareup.com/help/article/5394), you _must_ provide values for the following parameters in your request:  - &#x60;buyer_email_address&#x60; - At least one of &#x60;billing_address&#x60; or &#x60;shipping_address&#x60;  When this response is returned, the amount of Square&#39;s processing fee might not yet be calculated. To obtain the processing fee, wait about ten seconds and call [RetrieveTransaction](#endpoint-retrievetransaction). See the &#x60;processing_fee_money&#x60; field of each [Tender included](#type-tender) in the transaction.
   * @param locationId The ID of the location to associate the created transaction with. (required)
   * @param body An object containing the fields to POST for the request.  See the corresponding object definition for field details. (required)
   * @return ChargeResponse
   * @throws ApiException if fails to make API call
   */
Charge
Charges a card represented by a card nonce or a customer's card on file.
Charge Charges a card represented by a card nonce or a customer ' s card on file .
@Deprecated
  public ChargeResponse charge(String locationId, ChargeRequest body) throws ApiException {
    Object localVarPostBody = body;
    if (locationId == null) {
      throw new ApiException(400, "Missing the required parameter 'locationId' when calling charge");
    }
    if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling charge");
    }
    String localVarPath = "/v2/locations/{location_id}/transactions"
      .replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
    List<Pair> localVarQueryParams = new ArrayList<Pair>();
    Map<String, String> localVarHeaderParams = new HashMap<String, String>();
    Map<String, Object> localVarFormParams = new HashMap<String, Object>();
    localVarHeaderParams.put("Square-Version", "2019-11-20");
    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
    String[] localVarAuthNames = new String[] { "oauth2" };
    GenericType<ChargeResponse> localVarReturnType = new GenericType<ChargeResponse>() {};
    CompleteResponse<ChargeResponse> completeResponse = (CompleteResponse<ChargeResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    return completeResponse.getData();
      }
@ Deprecated public ChargeResponse charge ( String locationId , ChargeRequest body ) throws ApiException { Object localVarPostBody = body ; if ( locationId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'locationId' when calling charge" ) ; } if ( body == null ) { throw new ApiException ( 400 , "Missing the required parameter 'body' when calling charge" ) ; } String localVarPath = "/v2/locations/{location_id}/transactions" . replaceAll ( "\\{" + "location_id" + "\\}" , apiClient . escapeString ( locationId . toString ( ) ) ) ; List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < String , Object > localVarFormParams = new HashMap < String , Object > ( ) ; localVarHeaderParams . put ( "Square-Version" , "2019-11-20" ) ; final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { "application/json" } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "oauth2" } ; GenericType < ChargeResponse > localVarReturnType = new GenericType < ChargeResponse > ( ) { } ; CompleteResponse < ChargeResponse > completeResponse = ( CompleteResponse < ChargeResponse > ) apiClient . invokeAPI ( localVarPath , "POST" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ; return completeResponse . getData ( ) ; }
Charge
 Charges a card represented by a card nonce or a customer&#39;s card on file.
Charge Charges a card represented by a card nonce or a customer&#39 ; s card on file .
// verify the required parameter 'locationId' is set // verify the required parameter 'body' is set // create path and map variables // query params