src/main/java/com/squareup/connect/api/PaymentsApi.java
public CancelPaymentResponse cancelPayment(String paymentId) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'paymentId' is set
    if (paymentId == null) {
      throw new ApiException(400, "Missing the required parameter 'paymentId' when calling cancelPayment");
    }
    
    // create path and map variables
    String localVarPath = "/v2/payments/{payment_id}/cancel"
      .replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.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<CancelPaymentResponse> localVarReturnType = new GenericType<CancelPaymentResponse>() {};
    CompleteResponse<CancelPaymentResponse> completeResponse = (CompleteResponse<CancelPaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    return completeResponse.getData();
      }
/**
   * CancelPayment
   * Cancels (voids) a payment. If you set &#x60;autocomplete&#x60; to false when creating a payment,  you can cancel the payment using this endpoint. For more information, see  [Delayed Payments](/payments-api/take-payments#delayed-payments).
   * @param paymentId &#x60;payment_id&#x60; identifying the payment to be canceled. (required)
   * @return CancelPaymentResponse
   * @throws ApiException if fails to make API call
   */
CancelPayment
Cancels (voids) a payment. If you set `autocomplete` to false when creating a payment,  you can cancel the payment using this endpoint. For more information, see  [Delayed Payments](/payments-api/take-payments#delayed-payments).
@param paymentId `payment_id` identifying the payment to be canceled. (required)
@return CancelPaymentResponse
@throws ApiException if fails to make API call
CancelPayment Cancels ( voids ) a payment . If you set ` autocomplete ` to false when creating a payment you can cancel the payment using this endpoint . For more information see [ Delayed Payments ] ( / payments - api / take - payments#delayed - payments ) . @param paymentId ` payment_id ` identifying the payment to be canceled . ( required ) @return CancelPaymentResponse @throws ApiException if fails to make API call
public CancelPaymentResponse cancelPayment(String paymentId) throws ApiException {
    Object localVarPostBody = null;
    if (paymentId == null) {
      throw new ApiException(400, "Missing the required parameter 'paymentId' when calling cancelPayment");
    }
    String localVarPath = "/v2/payments/{payment_id}/cancel"
      .replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.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<CancelPaymentResponse> localVarReturnType = new GenericType<CancelPaymentResponse>() {};
    CompleteResponse<CancelPaymentResponse> completeResponse = (CompleteResponse<CancelPaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    return completeResponse.getData();
      }
public CancelPaymentResponse cancelPayment ( String paymentId ) throws ApiException { Object localVarPostBody = null ; if ( paymentId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'paymentId' when calling cancelPayment" ) ; } String localVarPath = "/v2/payments/{payment_id}/cancel" . replaceAll ( "\\{" + "payment_id" + "\\}" , apiClient . escapeString ( paymentId . 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 < CancelPaymentResponse > localVarReturnType = new GenericType < CancelPaymentResponse > ( ) { } ; CompleteResponse < CancelPaymentResponse > completeResponse = ( CompleteResponse < CancelPaymentResponse > ) apiClient . invokeAPI ( localVarPath , "POST" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ; return completeResponse . getData ( ) ; }
CancelPayment
 Cancels (voids) a payment.
CancelPayment Cancels ( voids ) a payment .
// verify the required parameter 'paymentId' is set // create path and map variables // query params