code: public function cancelPayment($paymentToken, $reason = null)
      {
          if (!$paymentToken instanceof CancelPaymentRequest) {
              $paymentToken = new CancelPaymentRequest($paymentToken);
          }
  
          if ($reason !== null) {
              $paymentToken->setReason($reason);
          }
  
          ObjectRecursiveValidator::validate($paymentToken);
          $paymentSerializer = new CancelPaymentSerializer($paymentToken);
          $paymentTransport = new CancelPaymentTransport($paymentSerializer);
  
          return $this->execute($paymentTransport, CancelPaymentResponse::class);
      }
docs: @param string|CancelPaymentRequest $paymentToken
  @param string|null                 $reason
  
  @return CancelPaymentResponse|AbstractResponse
  
  @throws ResponseException
  @throws TransportException
  @throws ResponseParseException
  @throws JsonParseException